VxWorks Reference Manual : Libraries
iosLib - I/O system library
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
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.
iosLib.h
iosLib, intLib, ioLib, VxWorks Programmer's Guide: I/O System
iosInit( ) - initialize the I/O system
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) */ )
This routine initializes the I/O system. It must be called before any other I/O system routine.
OK, or ERROR if memory is insufficient.
iosDrvInstall( ) - install an I/O driver
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 */ )
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.
The driver number of the new driver, or ERROR if there is no room for the driver.
iosDrvRemove( ) - remove an I/O driver
STATUS iosDrvRemove ( int drvnum, /* no. of driver to remove, returned by iosDrvInstall() */ BOOL forceClose /* if TRUE, force closure of open files */ )
This routine removes an I/O driver (added by iosDrvInstall( )) from the driver table.
OK, or ERROR if the driver has open files.
iosLib, iosDrvInstall( )
iosDevAdd( ) - add a device to the I/O system
STATUS iosDevAdd ( DEV_HDR * pDevHdr, /* pointer to device's structure */ char * name, /* name of device */ int drvnum /* no. of servicing driver, returned by */ )
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.
OK, or ERROR if there is already a device with the specified name.
iosDevDelete( ) - delete a device from the I/O system
void iosDevDelete ( DEV_HDR * pDevHdr /* pointer to device's structure */ )
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.
N/A
iosDevFind( ) - find an I/O device in the device list
DEV_HDR *iosDevFind ( char * name, /* name of the device */ char * *pNameTail /* where to put ptr to tail of name */ )
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.
A pointer to the device header, or NULL if the device is not found.
iosFdValue( ) - validate an open file descriptor and return the driver-specific value
int iosFdValue ( int fd /* file descriptor to check */ )
This routine checks to see if a file descriptor is valid and returns the driver-specific value.
The driver-specific value, or ERROR if the file descriptor is invalid.