VxWorks Reference Manual : Libraries
strmLib - driver for the WindNet STREAMS I/O system (STREAMS Option)
strmDriverAdd( ) - add a STREAMS driver into the STREAMS subsystem (STREAMS Option)
strmModuleAdd( ) - add a STREAMS module to the STREAMS subsystem (STREAMS Option)
strmTimeout( ) - execute a routine in a specified length of time (STREAMS Option)
strmUntimeout( ) - cancel previous strmTimeout( ) call (STREAMS Option)
strmSleep( ) - suspend task execution pending occurrence of an event (STREAMS Option)
strmWakeup( ) - resume suspended task execution (STREAMS Option)
strmSyncWriteAccess( ) - access a shared data structure for synchronous writing (STREAMS Option)
strmWeld( ) - connect the q_next pointers of arbitrary streams (STREAMS Option)
strmUnWeld( ) - set the q_next pointers of streams queues to NULL (STREAMS Option)
strmPipe( ) - create an intertask channel (STREAMS Option)
strmMkfifo( ) - create a STREAMS FIFO (STREAMS Option)
mps_fd_to_sth( ) - return the Stream Head pointer for a given fd
This library is a VxWorks device driver that provides the programmer interface to the WindNet STREAMS head, and therefore, to any STREAMS driver or module in the system. It provides the standard open, close, read, write and ioctl routines (including select( )), as well as routines to load a driver or module, and the STREAMS poll( ) routine.
strmDriverAdd( ) - add a STREAMS driver into the STREAMS subsystem (STREAMS Option)
STATUS strmDriverAdd ( char * pStrmDriverName, /* driver name */ struct streamtab * pStreamtab, /* ptr to driver streamtab */ int cloneFlag, /* TRUE = clone device */ struct streamtab * pBuddyStreamtab, /* ptr to driver buddy streamtab */ int flags, /* open style SVR3 or SVR4 */ int sqlvl /* synchronization level */ )
This routine adds a STREAMS driver into the STREAMS subsystem. The input parameters are the driver name, the streamtab of the driver, the clone flag (to specify clone devices or non-clone devices), the streamtab for the writer buddy, the open style type supported by driver, and the synchronization level.
For more information about writer buddies, see the WindNet STREAMS Optional Component Supplement.
OK if successful, otherwise ERROR.
S_strmLib_INVALID_OPEN_STYLE
Invalid flags parameter. Must be SVR3_STYLE_OPEN or SVR4_STYLE_OPEN.S_strmLib_INVALID_SYNC_LEVEL
Invalid synchronization-level parameter.
strmModuleAdd( ) - add a STREAMS module to the STREAMS subsystem (STREAMS Option)
STATUS strmModuleAdd ( char * pModuleName, /* module name */ struct streamtab * pStreamtab, /* ptr to Module streamtab */ struct streamtab * pBuddyStreamtab, /* ptr to Buddy streamtab */ int flags, /* open style SVR3 or SVR4 */ int sqlvl /* synchronization level */ )
This routine installs a STREAMS module into the STREAMS subsystem. The input parameters are the module name, the streamtab of the driver, the streamtab of the writer buddy, the open style type supported by the module, and the synchronization level.
For more information about writer buddies, see the WindNet STREAMS Optional Component Supplement.
OK if successful, otherwise ERROR.
S_strmLib_INVALID_OPEN_STYLE
Invalid flags parameter. Must be SVR3_STYLE_OPEN or SVR4_STYLE_OPEN.S_strmLib_INVALID_SYNC_LEVEL
Invalid sqlvl level parameter.
strmTimeout( ) - execute a routine in a specified length of time (STREAMS Option)
int strmTimeout ( void (* pFunc)(), /* timeout callback function */ caddr_t pArg, /* argument to callback function */ long ticks /* time when callback should be called */ )
This routine schedules the function specified by pFunc to be called after a specified time interval. The pArg parameter is passed as the only argument to pFunc.
The timer ID.
N/A
strmLib, strmUntimeout( )
strmUntimeout( ) - cancel previous strmTimeout( ) call (STREAMS Option)
void strmUntimeout ( int timeoutId /* timer ID to be cancelled */ )
This routine cancels the pending strmTimeout( ) request specified by timeoutId.
N/A
N/A
strmLib, strmTimeout( )
strmSleep( ) - suspend task execution pending occurrence of an event (STREAMS Option)
int strmSleep ( ulong_t event /* sleep event */ )
This routine suspends execution of a task to await an event specified in the parameter event. STREAMS drivers and modules are only allowed to invoke strmSleep( ) during their open and close procedures. STREAMS components that invoke strmSleep( ) can be awakened by strmWakeup( ) after the awaited event has occurred.
N/A
N/A
strmLib, strmWakeup( )
strmWakeup( ) - resume suspended task execution (STREAMS Option)
void strmWakeup ( ulong_t event /* tasks to be woken up for this event */ )
This routine awakens tasks sleeping on the specified event and makes them eligible for scheduling.
N/A
N/A
strmSyncWriteAccess( ) - access a shared data structure for synchronous writing (STREAMS Option)
void strmSyncWriteAccess ( queue_t * pQueue, /* queue to acquire only for write */ mblk_t * pMsg, /* message block to pass to callback */ void (* pFuncToWrite)(PCELL, mblk_t * ) /* callback for write operation */ )
This routine is provided to STREAMS drivers and modules to gain exclusive write access to a shared data structure.
The read-side and write-side queues of an IP module operate independently; however, when an IP instance updates its routing table, it requires temporary exclusive access to the routing table shared among all IP instances.
N/A
N/A
strmWeld( ) - connect the q_next pointers of arbitrary streams (STREAMS Option)
STATUS strmWeld ( queue_t * pQdst1, /* pQdts1->q_next is set to pQsrc1 */ queue_t * pQsrc1, /* new value for pQdst1->q_next */ queue_t * pQdst2, /* pQdts2->q_next is set to pQsrc2 */ queue_t * pQsrc2, /* new value for pQdst2->q_next */ void (* pFunc)(), /* callback to notify weld completion */ u32 arg0, /* argument 1 to callback */ u32 arg1 /* argument 2 to callback */ )
This routine connects q_next pointers of arbitrary streams to facilitate construction of STREAMS configurations not supported by normal STREAMS services. The routine strmWeld( ) does not connect the q_next pointers synchronously at its invocation. An optional callback function can be specified as the argument pFunc to strmWeld( ). The callback function is invoked after the q_next pointers have been connected.
A loopback configuration can be constructed by setting the driver's write-side q_next pointer to its read-side queue. The strmWeld( ) call would have pQdst1 set to point to the driver write-side queue, pQsrc2 set to its read-side queue, and the rest of the parameters set to NULL.
OK if successful, otherwise ERROR.
strmUnWeld( ) - set the q_next pointers of streams queues to NULL (STREAMS Option)
STATUS strmUnWeld ( queue_t * pQdst1, /* pQdts1->q_next is set to NULL */ queue_t * pQdst2, /* pQdts2->q_next is set to NULL */ void (* pFunc)(), /* callback to notify unweld completion */ u32 arg0, /* argument 1 to callback */ u32 arg1 /* argument 2 to callback */ )
This routine removes queue links performed by strmWeld( ) operations. It assigns NULL to the q_next fields of the queue parameters pQdst1 and pQdst2. The routine strmUnWeld( ) does not set the q_next pointers to NULL synchronously at its invocation. An optional callback function can be specified as the argument pFunc to strmUnWeld( ). The callback function is invoked after the q_next pointers have been set to NULL.
OK if successful, otherwise ERROR.
strmPipe( ) - create an intertask channel (STREAMS Option)
int strmPipe ( int * fds /* pointer to an array of file descriptors */ )
This routine creates an I/O mechanism called a pipe and returns two file descriptors, fds[0] and fds[1]. The files associated with fds[0] and fds[1] are streams and are opened for reading and writing.
A read from fds[0] accesses the data written to fds[1] on a first-in-first-out (FIFO) basis. A read from fds[1] accesses the data written to fds[0], also on a FIFO basis.
0 if successful, otherwise -1.
Errors from open( ).
strmMkfifo( ) - create a STREAMS FIFO (STREAMS Option)
int strmMkfifo()
This routine creates an I/O mechanism called a first-in-first-out (FIFO) and returns a file descriptor. The file associated with the file descriptor is a stream. The data written to the file descriptor can be read on a first-in-first-out basis by making read calls to the same file descriptor.
A file descriptor if successful, otherwise -1.
Errors from open( ).
mps_fd_to_sth( ) - return the Stream Head pointer for a given fd
void * mps_fd_to_sth ( OSRP osr, int fildes )
This routine obtains the stream head pointer for a file descriptor. It uses an internal ioctl request to obtain this value, thereby avoiding internal knowledge of the VxWorks I/O library in this module.
Stream head pointer or zero
As returned from iosFdValue