VxWorks Reference Manual : Libraries

strmLib

NAME

strmLib - driver for the WindNet STREAMS I/O system (STREAMS Option)

ROUTINES

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

DESCRIPTION

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.

SEE ALSO

strmLib


Libraries : Routines

strmDriverAdd( )

NAME

strmDriverAdd( ) - add a STREAMS driver into the STREAMS subsystem (STREAMS Option)

SYNOPSIS

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 */
    )

DESCRIPTION

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.

RETURNS

OK if successful, otherwise ERROR.

ERRNO

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.

SEE ALSO

strmLib


Libraries : Routines

strmModuleAdd( )

NAME

strmModuleAdd( ) - add a STREAMS module to the STREAMS subsystem (STREAMS Option)

SYNOPSIS

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 */
    )

DESCRIPTION

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.

RETURNS

OK if successful, otherwise ERROR.

ERRNO

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.

SEE ALSO

strmLib


Libraries : Routines

strmTimeout( )

NAME

strmTimeout( ) - execute a routine in a specified length of time (STREAMS Option)

SYNOPSIS

int strmTimeout
    (
    void (* pFunc)(), /* timeout callback function */
    caddr_t pArg,     /* argument to callback function */
    long    ticks     /* time when callback should be called */
    )

DESCRIPTION

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.

RETURNS

The timer ID.

ERRNO

N/A

SEE ALSO

strmLib, strmUntimeout( )


Libraries : Routines

strmUntimeout( )

NAME

strmUntimeout( ) - cancel previous strmTimeout( ) call (STREAMS Option)

SYNOPSIS

void strmUntimeout
    (
    int timeoutId /* timer ID to be cancelled */
    )

DESCRIPTION

This routine cancels the pending strmTimeout( ) request specified by timeoutId.

RETURNS

N/A

ERRNO

N/A

SEE ALSO

strmLib, strmTimeout( )


Libraries : Routines

strmSleep( )

NAME

strmSleep( ) - suspend task execution pending occurrence of an event (STREAMS Option)

SYNOPSIS

int strmSleep
    (
    ulong_t event /* sleep event */
    )

DESCRIPTION

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.

RETURNS

N/A

ERRNO

N/A

SEE ALSO

strmLib, strmWakeup( )


Libraries : Routines

strmWakeup( )

NAME

strmWakeup( ) - resume suspended task execution (STREAMS Option)

SYNOPSIS

void strmWakeup
    (
    ulong_t event /* tasks to be woken up for this event */
    )

DESCRIPTION

This routine awakens tasks sleeping on the specified event and makes them eligible for scheduling.

RETURNS

N/A

ERRNO

N/A

SEE ALSO

strmLib, strmSleep( )


Libraries : Routines

strmSyncWriteAccess( )

NAME

strmSyncWriteAccess( ) - access a shared data structure for synchronous writing (STREAMS Option)

SYNOPSIS

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 */
    )

DESCRIPTION

This routine is provided to STREAMS drivers and modules to gain exclusive write access to a shared data structure.

EXAMPLE

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.

RETURNS

N/A

ERRNO

N/A

SEE ALSO

strmLib


Libraries : Routines

strmWeld( )

NAME

strmWeld( ) - connect the q_next pointers of arbitrary streams (STREAMS Option)

SYNOPSIS

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 */
    )

DESCRIPTION

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.

EXAMPLES

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.

RETURNS

OK if successful, otherwise ERROR.

SEE ALSO

strmLib


Libraries : Routines

strmUnWeld( )

NAME

strmUnWeld( ) - set the q_next pointers of streams queues to NULL (STREAMS Option)

SYNOPSIS

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 */
    )

DESCRIPTION

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.

RETURNS

OK if successful, otherwise ERROR.

SEE ALSO

strmLib


Libraries : Routines

strmPipe( )

NAME

strmPipe( ) - create an intertask channel (STREAMS Option)

SYNOPSIS

int strmPipe
    (
    int * fds /* pointer to an array of file descriptors */
    )

DESCRIPTION

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.

RETURNS

0 if successful, otherwise -1.

ERRNO

Errors from open( ).

SEE ALSO

strmLib


Libraries : Routines

strmMkfifo( )

NAME

strmMkfifo( ) - create a STREAMS FIFO (STREAMS Option)

SYNOPSIS


int strmMkfifo()

DESCRIPTION

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.

RETURNS

A file descriptor if successful, otherwise -1.

ERRNO

Errors from open( ).

SEE ALSO

strmLib


Libraries : Routines

mps_fd_to_sth( )

NAME

mps_fd_to_sth( ) - return the Stream Head pointer for a given fd

SYNOPSIS

void * mps_fd_to_sth
    (
    OSRP osr,
    int  fildes
    )

DESCRIPTION

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.

RETURNS

Stream head pointer or zero

ERRNO

As returned from iosFdValue

SEE ALSO

strmLib