VxWorks Reference Manual : Libraries

iosLib

NAME

iosLib - I/O system library

ROUTINES

iosInit( ) - initialize the I/O system
iosDrvInstall( ) - install an I/O driver
iosDrvRemove( ) - remove an I/O driver
iosDevAdd( ) - add a device to the I/O system
iosDevDelete( ) - delete a device from the I/O system
iosDevFind( ) - find an I/O device in the device list
iosFdValue( ) - validate an open file descriptor and return the driver-specific value

DESCRIPTION

This library is the driver-level interface to the I/O system. Its primary purpose is to route user I/O requests to the proper drivers, using the proper parameters. To do this, iosLib keeps tables describing the available drivers (e.g., names, open files).

The I/O system should be initialized by calling iosInit( ), before calling any other routines in iosLib. Each driver then installs itself by calling iosDrvInstall( ). The devices serviced by each driver are added to the I/O system with iosDevAdd( ).

The I/O system is described more fully in the I/O System chapter of the Programmer's Guide.

INCLUDE FILES

iosLib.h

SEE ALSO

iosLib, intLib, ioLib, VxWorks Programmer's Guide: I/O System


Libraries : Routines

iosInit( )

NAME

iosInit( ) - initialize the I/O system

SYNOPSIS

STATUS iosInit
    (
    int    max_drivers, /* maximum number of drivers allowed */
    int    max_files,   /* max number of files allowed open at once */
    char * nullDevName  /* name of the null device (bit bucket) */
    )

DESCRIPTION

This routine initializes the I/O system. It must be called before any other I/O system routine.

RETURNS

OK, or ERROR if memory is insufficient.

SEE ALSO

iosLib


Libraries : Routines

iosDrvInstall( )

NAME

iosDrvInstall( ) - install an I/O driver

SYNOPSIS

int iosDrvInstall
    (
    FUNCPTR pCreate, /* pointer to driver create function */
    FUNCPTR pDelete, /* pointer to driver delete function */
    FUNCPTR pOpen,   /* pointer to driver open function */
    FUNCPTR pClose,  /* pointer to driver close function */
    FUNCPTR pRead,   /* pointer to driver read function */
    FUNCPTR pWrite,  /* pointer to driver write function */
    FUNCPTR pIoctl   /* pointer to driver ioctl function */
    )

DESCRIPTION

This routine should be called once by each I/O driver. It hooks up the various I/O service calls to the driver service routines, assigns the driver a number, and adds the driver to the driver table.

RETURNS

The driver number of the new driver, or ERROR if there is no room for the driver.

SEE ALSO

iosLib


Libraries : Routines

iosDrvRemove( )

NAME

iosDrvRemove( ) - remove an I/O driver

SYNOPSIS

STATUS iosDrvRemove
    (
    int  drvnum,    /* no. of driver to remove, returned by iosDrvInstall() */
    BOOL forceClose /* if TRUE, force closure of open files */
    )

DESCRIPTION

This routine removes an I/O driver (added by iosDrvInstall( )) from the driver table.

RETURNS

OK, or ERROR if the driver has open files.

SEE ALSO

iosLib, iosDrvInstall( )


Libraries : Routines

iosDevAdd( )

NAME

iosDevAdd( ) - add a device to the I/O system

SYNOPSIS

STATUS iosDevAdd
    (
    DEV_HDR * pDevHdr, /* pointer to device's structure */
    char *    name,    /* name of device */
    int       drvnum   /* no. of servicing driver, returned by */
    )

DESCRIPTION

This routine adds a device to the I/O system device list, making the device available for subsequent open( ) and creat( ) calls.

The parameter pDevHdr is a pointer to a device header, DEV_HDR (defined in iosLib.h), which is used as the node in the device list. Usually this is the first item in a larger device structure for the specific device type. The parameters name and drvnum are entered in pDevHdr.

RETURNS

OK, or ERROR if there is already a device with the specified name.

SEE ALSO

iosLib


Libraries : Routines

iosDevDelete( )

NAME

iosDevDelete( ) - delete a device from the I/O system

SYNOPSIS

void iosDevDelete
    (
    DEV_HDR * pDevHdr /* pointer to device's structure */
    )

DESCRIPTION

This routine deletes a device from the I/O system device list, making it unavailable to subsequent open( ) or creat( ) calls. No interaction with the driver occurs, and any file descriptors open on the device or pending operations are unaffected.

If the device was never added to the device list, unpredictable results may occur.

RETURNS

N/A

SEE ALSO

iosLib


Libraries : Routines

iosDevFind( )

NAME

iosDevFind( ) - find an I/O device in the device list

SYNOPSIS

DEV_HDR *iosDevFind
    (
    char * name,      /* name of the device */
    char * *pNameTail /* where to put ptr to tail of name */
    )

DESCRIPTION

This routine searches the device list for a device whose name matches the first portion of name. If a device is found, iosDevFind( ) sets the character pointer pointed to by pNameTail to point to the first character in name, following the portion which matched the device name. It then returns a pointer to the device. If the routine fails, it returns a pointer to the default device (that is, the device where the current working directory is mounted) and sets pNameTail to point to the beginning of name. If there is no default device, iosDevFind( ) returns NULL.

RETURNS

A pointer to the device header, or NULL if the device is not found.

SEE ALSO

iosLib


Libraries : Routines

iosFdValue( )

NAME

iosFdValue( ) - validate an open file descriptor and return the driver-specific value

SYNOPSIS

int iosFdValue
    (
    int fd /* file descriptor to check */
    )

DESCRIPTION

This routine checks to see if a file descriptor is valid and returns the driver-specific value.

RETURNS

The driver-specific value, or ERROR if the file descriptor is invalid.

SEE ALSO

iosLib