1queue(9S) Data Structures for Drivers queue(9S)
2
3
4
6 queue - STREAMS queue structure
7
9 #include <sys/stream.h>
10
11
13 Architecture independent level 1 (DDI/DKI)
14
16 A STREAMS driver or module consists of two queue structures: read for
17 upstream processing and write for downstream processing. The queue
18 structure is the major building block of a stream.
19
20 queue Structure Members
21 The queue structure is defined as type queue_t. The structure can be
22 accessed at any time from inside a STREAMS entry point associated with
23 that queue.
24
25 struct qinit *q_qinfo; /* queue processing procedure */
26 struct msgb *q_first; /* first message in queue */
27 struct msgb *q_last; /* last message in queue */
28 struct queue *q_next; /* next queue in stream */
29 void *q_ptr; /* module-specific data */
30 size_t q_count; /* number of bytes on queue */
31 uint_t q_flag; /* queue state */
32 ssize_t q_minpsz; /* smallest packet OK on queue */
33 ssize_t q_maxpsz; /* largest packet OK on queue */
34 size_t q_hiwat; /* queue high water mark */
35 size_t q_lowat; /* queue low water mark */
36
37
38
39 Contstraints and restrictions on the use of q_flag and queue_t fields
40 and the q_next values are detailed in the following sections.
41
42 q_flag Field
43 The q_flag field must be used only to check the following flag values.
44
45 QFULL Queue is full.
46
47
48 QREADR Queue is used for upstream (read-side) processing.
49
50
51 QUSE Queue has been allocated.
52
53
54 QENAB Queue has been enabled for service by qenable(9F).
55
56
57 QNOENB Queue will not be scheduled for service by putq(9F).
58
59
60 QWANTR Upstream processing element wants to read from queue.
61
62
63 QWANTW Downstream processing element wants to write to queue.
64
65
66 queue_t Fields
67 Aside from q_ptr and q_qinfo, a module or driver must never assume that
68 a queue_t field value will remain unchanged across calls to STREAMS
69 entry points. In addition, many fields can change values inside a
70 STREAMS entry point, especially if the STREAMS module or driver has
71 perimeters that allow parallelism. See mt-streams(9F). Fields that are
72 not documented below are private to the STREAMS framework and must not
73 be accessed.
74
75 o The values of the q_hiwat, q_lowat, q_minpsz, and q_maxpsz
76 fields can be changed at the discretion of the module or
77 driver. As such, the stability of their values depends on
78 the perimeter configuration associated with any routines
79 that modify them.
80
81 o The values of the q_first, q_last, and q_count fields can
82 change whenever putq(9F), putbq(9F), getq(9F), insq(9F), or
83 rmvq(9F)