Queues


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.h
 struct  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 :

  • Pointer to the qinit structure, defining the functions to be used to process data in this queue, module information, and module statistics structures.

  • Pointers to the data on this queue: the q_first pointer to a msgb structure is the start of the first message (a linked list of message blocks).

  • Pointer to the next queue in sequence. This is the next queue on the Stream and will be the queue that receives the data when it's taken off the current queue.

  • q_ptr - private data, usable by modules and drivers.

  • Byte count for queue data.

  • Various flags.

  • Packet (message) sizes.

  • Limits (byte counts).

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.




PANIC. UNIX System Crash Dump Analysis Handbook
PANIC! UNIX System Crash Dump Analysis Handbook (Bk/CD-ROM)
ISBN: 0131493868
EAN: 2147483647
Year: 1994
Pages: 289
Authors: Chris Drake

flylib.com © 2008-2017.
If you may any questions please contact us: flylib@qtcs.net