The basic operations to handle queues all involve the queue structure. This is slightly different between SunOS 4.x and Solaris 2, but essentially the Solaris 2 version contains the exact same data plus some locking and priority control information at the end. The front of the structures looks identical. (We include the definitions here because you're going to need to refer to them later). Example 25-2 Queue structure as defined in /usr/include/sys/stream.hstruct queue { struct qinit *q_qinfo; /* procs and limits for queue */ struct msgb *q_first; /* first data block */ struct msgb *q_last; /* last data block */ struct queue *q_next; /* Q of next stream */ struct queue *q_link; /* to next Q for scheduling */ void *q_ptr; /* to private data structure */ ulong q_count; /* number of bytes on Q */ ulong q_flag; /* queue state */ long q_minpsz; /* min packet size accepted by */ /* this module */ long q_maxpsz; /* max packet size accepted by */ /* this module */ ulong q_hiwat; /* queue high water mark */ ulong q_lowat; /* queue low water mark */ The following structure elements appear only in the Solaris 2 queue structure struct qband *q_bandp; /* separate flow information */ kmutex_t q_lock; /* protect data queue */ struct stdata *q_stream; /* for head locks */ struct syncq *q_syncq; /* sync queue object */ unsigned char q_nband; /* number of priority bands > 0 */ kcondvar_t q_wait; /* read/write sleeps */ kcondvar_t q_sync; /* open/close sleeps */ struct queue *q_nfsrv; /* next q fwd with service routine */ struct queue *q_nbsrv; /* next q back with service routine */ }; Some of the common elements are as follows :
The data on a queue is composed of individual messages , which are linked together in a prioritized order. Each message can be composed of several chunks of data, but they are all pointed to by the initial message msgb or mblk_t structure. Note The msgb structure is defined via a typedef as being a mblk_t type. You often see messages referred to as either msgb or mblk structures. |