STREAMS/UX Programmer's Guide (October 2005)

Modules and Drivers
Data Structures
Chapter 4
77
The streams_info_t Structure
The streams_info_t structure must be defined for both STREAMS modules and drivers. This structure
contains the following fields:
char *name; /* name of the driver or a module */
int inst_major; /* major number for driver */
struct streamtab inst_str_tab; /* current streams tab entry */
unsigned int inst_flags; /* stream flags */
int inst_sync_level; /* Synchronization Level */
char inst_sync_info[FMNAMESZ+1]; /* Elsewhere sync param. */
/* Set NULL string if not used. */
name Points to a string containing the name of the driver. This value must match the name
specified in the module metadata.
inst_major Assign the major number to -1 for dynamic assignment. If the major number is manually
assigned, you must assign a unique number. Ensure that the inst_major matches with the
contents of the c_major field in drv_info_t. For STREAMS modules, set to -1.
inst_str_tab The streamtab data structure associated with driver or module.
inst_flags The inst_flags can contain the bitwise OR of the following flags:
STR_IS_DEVICE 0x00000001 /* For STREAMS driver. */
STR_IS_MODULE 0x00000002 /* For STREAMS module. */
MGR_IS_MP 0x00000008 /* Driver/module is MP safe
Defined in <sys/conf.h>. */
STR_SYSV4_OPEN 0x00000100 /* Supports SVR4 style open()
and close() routines */
STR_MP_OPEN_CLOSE 0x00001000 /* Indicates open() and close()
routines are MP-safe. */
inst_sync_level
The synchronization level used in the streams_info_t structure is defined in
<sys/stream.h>. The synchronization level determines the level of concurrent access to the
module and driver in STREAMS/UX.
The supported synchronization levels are as follows:
SQLVL_NOSYNC Nosync level synchronization. This provides the
maximum level of parallelism. Multiple threads can
independently access the read and write queues.
SQLVL_QUEUE Queue level synchronization. Two threads can
independently access the read and write queues.
SQLVL_QUEUEPAIR Queue-pair level synchronization. Only one thread can
access the read and write queues for each instance of a
driver or module.
SQLVL_DEFAULT Default level synchronization. It is the same as
SQLVL_QUEUEPAIR.