| adjmsg (D3) | trim bytes from a message |
| allocb (D3) | allocate a message block |
| bcanput (D3) | test for flow control in a specified priority band |
| bcanputnext (D3) | test for flow control in a specified priority band |
| bufcall (D3) | call a function when a buffer becomes available |
| canput (D3) | test for room in a message queue |
| canputnext (D3) | test for flow control in a stream |
| copyb (D3) | copy a message block |
| copymsg (D3) | copy a message |
| datamsg (D3) | test whether a message is a data message |
| dupb (D3) | duplicate a message block |
| dupmsg (D3) | duplicate a message |
| enableok (D3) | allow a queue to be serviced |
| esballoc (D3) | allocate a message block using an externally supplied buffer |
| esbbcall (D3) | call a function when an externally supplied buffer can be allocated |
| flushband (D3) | flush messages in a specified priority band |
| flushq (D3) | flush messages on a queue |
| freeb (D3) | free a message block |
| freemsg (D3) | free a message |
| freezestr (D3) | freeze the state of a stream |
| getq (D3) | get the next message from a queue |
| insq (D3) | insert a message into a queue |
| linkb (D3) | concatenate two message blocks |
| msgdsize (D3) | return number of bytes of data in a message |
| msgpullup (D3) | concatenate bytes in a message |
| noenable (D3) | prevent a queue from being scheduled |
| OTHERQ (D3) | get a pointer to queue's partner queue |
| pullupmsg (D3) | concatenate bytes in a message |
| put (D3) | call a put procedure |
| putbq (D3) | place a message at the head of a queue |
| putctl (D3) | send a control message to a queue |
| putctl1 (D3) | send a control message with a one-byte parameter to a queue |
| putnext (D3) | send a message to the next queue |
| putnextctl (D3) | send a control message to a queue |
| putnextctl1 (D3) | send a control message with a one-byte parameter to a queue |
| putq (D3) | put a message on a queue |
| qenable (D3) | schedule a queue's service routine to be run |
| qprocsoff (D3) | disable put and service routines |
| qprocson (D3) | enable put and service routines |
| qreply (D3) | send a message in the opposite direction in a stream |
| qsize (D3) | find the number of messages on a queue |
| RD (D3) | get a pointer to the read queue |
| rmvb (D3) | remove a message block from a message |
| rmvq (D3) | remove a message from a queue |
| SAMESTR (D3) | test if next queue is of the same type |
| strqget (D3) | get information about a queue or band of the queue |
| strqset (D3) | change information about a queue or band of the queue |
| unbufcall (D3) | cancel a pending bufcall request |
| unfreezestr (D3) | unfreeze the state of a stream |
| unlinkb (D3) | remove a message block from the head of the stream |
| WR (D3) | get a pointer to the write queue |
NAME
Shows command invocation and the required syntax.
| Home |
|---|
Arguments:
Return Values:
If the message can be trimmed successfully, 1 is returned. Otherwise,
0 is returned.
Usage:
|len| (the absolute value of len) specified how many bytes are to be removed. If len is greater than 0, bytes are removed from the head of the message. If len is less than 0, bytes are removed from the tail. adjmsg fails if |len| is greater than the number of bytes in mp. If len spans more than one message block in the message, the messages blocks must be the same type, or else adjmsg will fail.
If len is greater than the amount of data in a single message
block, that message block is not freed. Rather, it is left linked in the
message, and its read and write pointers are set equal to each other, indicating
no data present in the block.
Level:
Base or Interrupt.
Synchronization Constraints:
Does not sleep.
Driver-defined mask locks and simple locks may be held across calls to this function.
| Home |
|---|
mblk_t *allocb(int size, uint_t pri);
Arguments:
One of the following three values can be selected for this priority: BPRI_LO, BPRI_MED, or BPRI_HI.
Return Values:
If successful, allocb returns a pointer to the allocated message
block of type M_DATA (defined in sys/stream.h). If a block
cannot be allocated, a NULL pointer is returned.
Usage:
Buffer allocation fails only when the system is out of memory. If no buffer is available, the bufcall(D3) function can help a module recover from an allocation failure.
The following figure identifies the data structure members that are affected when a message block is allocated.

Level:
Base or Interrupt.
Synchronization Constraints:
Does not sleep. Driver-defined mask locks and simple locks may be held across calls to this function.
| Home |
|---|
#include <sys/types.h>
#include <sys/stream.h>
int bcanput(queue_t *q, uchar_t pri);
Arguments:
Return Values:
bcanput returns 1 if a message of priority pri can be
sent in the stream, or 0 if the priority band is flow-controlled. If bcanput
reaches the end of the stream without finding a queue with a service
routine, then it returns 1.
Usage:
The driver is responsible for both testing a queue with bcanput and refraining from placing a message on the queue if bcanput fails.
It is possible because of race conditions to test for room using bcanput and get an indication that there is room for a message, and then have the queue fill up before subsequently enqueuing the message, causing a violation of flow control. This is not a problem, since the violation of flow control in this case is bounded.
In multithreaded drivers, the q argument may not reference q_next (for example, an argument of q->q_next is erroneous in a multithreaded driver and is disallowed by the DDI/DKI). bcanputnext(q) is provided as a multiprocessor-safe equivalent to the common call bcanput(q->q_next), which is no longer allowed [see canputnext(D3)].
If pri is 0, the bcanput call is equivalent to a call
to canput.
Level:
Base or Interrupt.
Synchronization Constraints:
Does not sleep. Driver-defined mask locks may be held across calls to this function. In module, driver-defined locks must not be held.
The caller cannot have the stream frozen [see freezestr(D3)] when calling this function.
| Home |
|---|
int bcanputnext(queue_t *q, uchar_t pri);
Arguments:
bcanputnext returns 1 if a message of priority pri can
be sent in the stream, or 0 if the priority band is flow-controlled. If
bcanputnext reaches the end of the stream without finding a queue
with a service routine, then it returns 1.
Usage:
The driver writer is responsible for both testing a queue with bcanputnext and refraining from placing a message on the queue if bcanputnext fails.
It is possible because of race conditions to test for room using bcanputnext and get an indication that there is room for a message, and then have the queue fill up before subsequently enqueuing the message, causing a violation of flow control. This is not a problem since the violation of flow control in this case is bounded.
In multithreaded drivers, the q argument to bcanput(D3) and bcanputnext may not reference q_next (for example, an argument of q->q_next is erroneous in a multithreaded driver and is disallowed by the DDI/DKI). bcanputnext(q) is provided as a multiprocessor-safe equivalent to the common all bcanput (q->q_next), which is no longer allowed.
If pri is 0, the bcanputnext call is equivalent to a call
to canputnext.
Level:
Initialization, Base or Interrupt.
Synchronization Constraints:
Does not sleep. Driver-defined mask locks may be held across calls to this function. In module, driver-defined locks must not be held.
The caller cannot have the stream frozen [see freezestr(D3)] when calling this function.
| Home |
|---|
#include <sys/types.h>
#include <sys/stream.h>
toid_t bufcall(uint_t size, int pri, void (*func)(), long long arg);
Arguments:
Return Values:
Upon success, bufcall returns a non-zero value that identifies
the scheduling request. On failure, bufcall returns 0.
Usage:
When func runs, all interrupts from STREAMS devices will be blocked. On multiprocesssor systems, when func runs, all interrupts from STREAMS devices will be blocked on the processor on which func is running. func will have no user context and may not call any func that sleeps.
Even when func is called, allocb can still fail if another module or driver had allocated the buffer before func was able to call allocb.
The pri argument is the priority of the allocation request.
The nonzero identifier returned by bufcall may be passed to unbufcall(D3)
to cancel the request.
Level:
Base or Interrupt.
Synchronization Constraints:
Does not sleep. Driver-defined mask locks may be held across calls to this function.
| Home |
|---|
int canput(queue_t *q);
DESCRIPTION
Arguments:
Return Values:
canput returns 1 if a message can be placed on the queue. 0 is
returned if a message cannot be enqueued because of flow control.
Usage:
The driver is responsible for both testing a queue with canput and refraining from placing a message on the queue if canput fails.
It is possible because of race conditions to test for room using canput and get an indication that there is room for a message, and then have the queue fill up before subsequently enqueuing the message, causing a violation of flow control. This is not a problem, since the violation of flow control in this case is bounded.
In multithreaded drivers, the q argument may not reference q_next
(for example, an argument of q->q_next is erroneous in a multithreaded
driver and is disallowed by the DDI/DKI). canputnext(q) is provided
as a multiprocessor-safe equivalent to the common call canput(q->q_next),
which is no longer allowed [see canputnext(D3)].
Level:
Base or Interrupt.
Synchronization Constraints:
Does not sleep. Driver-defined mask locks may be held across calls to this function. In module, driver-defined locks must not be held.
The caller cannot have the stream frozen [see freezestr(D3)] when calling this function.
| Home |
|---|
int canputnext(queue_t *q);
Arguments:
Return Values:
canputnext returns 1 if a message can be sent in the stream,
or 0 if the stream is flow-controlled. If canputnext reaches the
end of the stream without finding a queue with a service routine, then
it returns 1.
Usage:
The driver is responsible for both testing a queue with canputnext and refraining from placing a message on the queue if canputnext fails.
It is possible because of race conditions to test for room using canputnext and get an indication that there is room for a message, and then have the queue fill up before subsequently enqueuing the message, causing a violation of flow control. This is not a problem since the violation of flow control in this case is bounded.
The q argument may not reference q_next (for example, an argument of q->q_next is erroneous in a multithreaded driver and is disallowed by the DDI/DKI).
In multithreaded drivers, the q argument may not reference q_next (for example, an argument of q->q_next is erroneous in a multithreaded driver and is disallowed by the DDI/DKI). canputnext(q) is provided as a multiprocessor-safe equivalent to the common call canput (q->q_next), which is no longer allowed.
Level:
Base or Interrupt.
Synchronization Constraints:
Does not sleep. Driver-defined mask locks may be held across calls to this function. In module, driver-defined locks must not be held.
The caller cannot have the stream frozen [see freezestr(D3)] when calling this function.
| Home |
|---|
mblk_t *copyb(mblk_t *bp);
Arguments:
Return Values:
On success, copyb returns a pointer to the newly allocated message
block containing the copied data. On failure, it returns a NULL pointer.
Level:
Base or Interrupt.
Synchronization Constraints:
Does not sleep. Driver-defined mask locks may be held across calls to this function. In module, driver-defined locks must not be held.
| Home |
|---|
mblk_t *copymsg(mblk_t *mp);
Arguments:
Return Values:
On success, copymsg returns a pointer to the new message. On
failure, it returns a NULL pointer.
Level:
Base or Interrupt.
Synchronization Constraints:
Does not sleep. Driver-defined mask locks and simple locks may be held across calls to this function. In module, driver-defined locks must not be held.
| Home |
|---|
int datamsg(uchar_t type);
Arguments:
Return Values:
datamsg returns 1 if the message is a data message and 0 if the
message is any other type.
Usage:
The db_type field of the datab structure contains the
message type. This field may be accessed through the message block using
mp->b_datap->db_type.
Level:
Base or Interrupt.
Synchronization Constraints:
Does not sleep. Driver-defined mask locks and simple locks may be held across calls to this function.
xxxput(q, mp)
queue_t *q;
mblk_t *mp;
{
if (datamsg(mp->b_datap->db_type)) {
putq(q, mp);
return;
}
switch (mp->b_datap->db_type) {
case M_FLUSH:
...
}
}
| Home |
|---|
mblk_t *dupb(mblk_t *bp);
Arguments:
Return Values:
On success, dupb returns a pointer to the new message block.
On failure, it returns a NULL pointer.
Usage:
The following figure shows how the db_ref field of the data block structure has been changed from 1 to 2, reflecting the increase in the number of references to the data block. The new message block contains the same information as the first. Note that b_rptr and b_wptr are copied from bp, and that db_ref is incremented.
Level:
Base or Interrupt.
Synchronization Constraints:
Does not sleep. Driver-defined mask locks and simple locks may be held across calls to this function.
| Home |
|---|
Arguments:
Return Values:
On success, dupmsg returns a pointer to the new message. On failure,
it returns a NULL pointer.
Level:
Base or Interrupt.
Synchronization Constraints:
Does not sleep. Driver-defined mask locks and simple locks may be held across calls to this function.
| Home |
|---|
void enableok(queue_t *q);
Arguments:
Return Values:
None
Level:
Base or Interrupt.
Synchronization Constraints:
Does not sleep. Driver-defined mask locks and simple locks may be held across calls to this function. In module, driver-defined locks must not be held.
The caller cannot have the stream frozen [see freezestr(D3)] when calling this function.
void
qrestart(q)
queue_t *q;
{
enableok(q);
if (q->q_first)
qenable(q);
}
| Home |
|---|
mblk_t *esballoc(uchar_t *base, int size, int pri, frtn_t *fr_rtnp);
Arguments:
| base | Address of driver-supplied data buffer. |
| size | Number of bytes in data buffer. |
| pri | Priority of allocation request (used to allocate the message and data blocks). The effective values are BPRI_LO, BPRI_MED, and BPRI_HI. |
| fr_rtnp | Pointer to the free-routine data structure. |
Return Values:
On success, a pointer to the newly allocated message block is returned.
On failure, NULL is returned.
Usage:
Instead of requiring a specific number of arguments, the free_arg field is defined of type char *.This way, the driver can pass a pointer to a structure if more than one argument is needed.
When the free_func function runs, interrupts from all STREAMS
devices will be blocked. It has no user context and may not call any routine
that sleeps. The function may not access any dynamically allocated data
structures that might no longer exist when it runs.
Level:
Base or Interrupt.
Synchronization Constraints:
Does not sleep. Driver-defined mask locks and simple locks may be held across calls to this function.
| Home |
|---|
int esbbcall(int pri, void (*func)(), long long arg);
Arguments:
| pri | Priority of the esballoc(D3) allocation request. |
| func | Function to be called when a buffer becomes available. |
| arg | Argument to the function to be called when a buffer becomes available. |
Return Values:
On success, esbbcall returns a nonzero value that identifies
the scheduling request. On failure, esbbcall returns 0.
Usage:
When func runs, all interrupts from STREAMS devices will be blocked. On multiprocessor systems, the interrupts will be blocked only on the processor on which func is running. func will have no user context and may not call any function that sleeps.
Even when func is called, esballoc can still fail if another module or driver had allocated the memory before func was able to call allocb.
The nonzero identifier returned by esballoc may be passed to
unbufcall(D3) to cancel the request.
Level:
Base or Interrupt.
Synchronization Constraints:
Does not sleep. Driver-defined mask locks and simple locks may be held across calls to this function.
| Home |
|---|
void flushband(queue_t *q, uchar_t pri, int flag);
If the band's count falls below the low water mark and someone wants to write to the band, the nearest upstream or downstream service procedure is enabled.
Arguments:
Return Values:
None
Usage:
Valid values for flag are:
| FLUSHDATA | Flush only data messages (types M_DATA, M_DELAY, M_PROTO, and M_PCPROTO). |
| FLUSHALL | Flush all messages. |
Level:
Base or Interrupt.
Synchronization Constraints:
Does not sleep. Driver-defined mask locks may be held across calls to this function. In module, driver-defined locks must not be held.
The caller cannot have the stream frozen [see freezestr(D3)] when calling this function.
| Home |
|---|
void flushq(queue_t *q, int flag);
Arguments:
Return Values:
None
Usage:
Valid values for flag are:
| FLUSHDATA | Flush only data messages (types M_DATA, M_DELAY, M_PROTO, and M_PCPROTO). |
| FLUSHALL | Flush all messages. |
Level:
Base or Interrupt.
Synchronization Constraints:
Does not sleep. Driver-defined mask locks may be held across calls to this function. In module, driver-defined locks must not be held.
The caller cannot have the stream frozen [see freezestr(D3)] when calling this function.
| Home |
|---|
void freeb(mblk_t *bp);
If the data buffer to be freed was allocated with esballoc(D3),
the driver is notified that the attached data buffer needs to be freed
by calling the free-routine [see free_rtn(D4)]
associated with the data buffer. Once this is accomplished, freeb releases
the STREAMS resources associated with the buffer.
Arguments:
Return Values:
None
Level:
Base or Interrupt.
Synchronization Constraints:
Does not sleep. Driver-defined mask locks and simple locks may be held across calls to this function.
| Home |
|---|
void freemsg(mblk_t *mp);
Arguments:
Return Values:
None
Level:
Base or Interrupt.
Synchronization Constraints:
Does not sleep. Driver-defined mask locks and simple locks may be held across calls to this function.
| Home |
|---|
int freezestr(queue_t *q);
Freezing the stream does not automatically stop all functions that are running within the stream; functions will continue to run until they attempt to perform some operation which changes the state of the stream, at which point they will be forced to wait for the stream to be unfrozen by a call to unfreezestr(D3).
Arguments:
Return Values:
freezestr returns the ID previous interrupt priority level which
is typically used in a subsequent call to unfreezestr.
Usage:
Drivers and modules must freeze the stream while they manipulate its
queues directly. This includes searching the queues and for the duration
of any calls to insq(D3), rmvq(D3),
strqset(D3), and strqget(D3).
Level:
Base or Interrupt.
Synchronization Constraints:
Does not sleep. Driver-defined mask locks may be held across calls to this function. In module, driver-defined locks must not be held.
| freezestr should be used sparingly as it is rarely
necessary to freeze a stream (most modules do not need to manipulate their
queues directly) and freezing a stream can have a significant negative
effect on performance.
Calling freezestr to freeze a stream that is already frozen by the caller will result in deadlock. |
| Home |
|---|
mblk_t *getq(queue_t *q);
Arguments:
Return Values:
If there is a message to retrieve, getq returns a pointer to
it. If no message is queued, getq returns a NULL pointer.
Usage:
getq is typically used by service routines [see srv(D2)]
to retrieve queued messages.
Level:
Base or Interrupt.
Synchronization Constraints:
Does not sleep. Driver-defined mask locks may be held across calls to this function. In module, driver-defined locks must not be held.
The caller cannot have the stream frozen [see freezestr(D3)] when calling this function.
| Home |
|---|
int insq(queue_t *q, mblk_t *emp, mblk_t *nmp);
Arguments:
Return Values:
If nmp was successfully enqueued, insq returns 1. Otherwise,
insq returns 0.
Usage:
Messages are ordered in the queue based on their priority, as described int srv(D2). If an attempt is made to insert a message out of order in the queue, then nmp is not enqueued.
The insertion can fail if there is not enough memory to allocate the accounting data structures used with messages whose priority bands are greater than zero.
If emp is non-NULL, it must point to a message in the
queue pointed to by q, or a system panic could result.
Level:
Base or Interrupt.
Synchronization Constraints:
Does not sleep. Driver-defined mask locks and simple locks may be held across calls to this function. In module, driver-defined locks must not be held.
The caller must have the stream frozen [see freezestr(D3)] when calling this function.
| Home |
|---|
Arguments:
Return Values:
None.
Level:
Base or Interrupt.
Synchronization Constraints:
Does not sleep. Driver-defined mask locks and simple locks may be held across calls to this function.
| Home |
|---|
int msgdsize(mblk_t *mp);
Arguments:
Return Values:
The number of bytes of data in the message.
Level:
Base or Interrupt.
Synchronization Constraints:
Does not sleep. Driver-defined mask locks and simple locks may be held across calls to this function.
| Home |
|---|
mblk_t *msgpullup(mblk_t *mp, int len);
The original message is unaltered. If len equals _1, all data are concatenated. If len bytes of the same message type cannot be found, msgpullup fails and returns NULL.
Arguments:
Return Values:
Upon success, msgpullup returns a pointer to the new message.
On failure, msgpullup returns NULL.
Level:
Base or Interrupt.
Synchronization Constraints:
Does not sleep. Driver-defined mask locks and simple locks may be held across calls to this function.
| Home |
|---|
void noenable(queue_t *q);
Arguments:
Return Values:
None
Usage:
The high-priority-only message restriction can be lifted with the enableok(D3)
function. noenable does not prevent the queue's service routine from being
scheduled when a high priority message is enqueued, or by an explicit call
to qenable(D3).
Level:
Base or Interrupt.
Synchronization Constraints:
Does not sleep. Driver-defined mask locks and simple locks may be held across calls to this function. In module, driver-defined locks must not be held.
The caller cannot have the stream frozen [see freezestr(D3)] when calling this function.
| Home |
|---|
queue_t *OTHERQ(queue_t *q);
Arguments:
Return Values:
OTHERQ returns a pointer to a queue's partner.
Level:
Base or Interrupt.
Synchronization Constraints:
Does not sleep. Multithreaded drivers may hold driver-defined mask locks, and simple locks across calls to this function.
Examples
This routine sets the minimum packet size, the maximum packet size, the high water mark, and the low water mark for the read and write queues of a given module or driver. It is passed either one of the queues. This could be used if a module or driver wished to update its queue parameters dynamically.
void
set_q_params(queue_t *q, long min, long max, ulong_t hi, ulong_t lo)
{
int pl; /* for multithreaded drivers */
pl = freezestr(q); /* for multithreaded drivers */
(void) strqset(q, QMINPSZ, 0, min);
(void) strqset(q, QMAXPSZ, 0, max);
(void) strqset(q, QHIWAT, 0, hi);
(void) strqset(q, QLOWAT, 0, lo);
(void) strqset(OTHERQ(q), QMINPSZ, 0, min);
(void) strqset(OTHERQ(q), QMAXPSZ, 0, max);
(void) strqset(OTHERQ(q), QHIWAT, 0, hi);
(void) strqset(OTHERQ(q), QLOWAT, 0, lo);
unfreezestr(q,pl); /* for multithreaded drivers */
}
| Home |
|---|
int pullupmsg(mblk_t *mp, int len);
Arguments:
Return Values:
On success, pullupmsg returns 1. On failure, pullupmsg returns
0.
Level:
Base or Interrupt.
Synchronization Constraints:
Does not sleep.
| Home |
|---|
Arguments:
Return Values:
None
Usage:
put is typically used by a driver or module to call its own put procedure so that the proper accounting is done in the stream.
On multiprocessor systems, DDI/DKI conforming drivers and modules are no longer permitted to call put procedures directly, but must call through the appropriate STREAMS utility function. For example, put(D3), putnext(D3), putctl(D3), putnextctl(D3), qreply(D3). put(q, mp) is provided as a DDI/DKI-conforming equivalent to a direct call to a put procedure, which is no longer allowed.
Level:
Base or Interrupt.
Synchronization Constraints:
Does not sleep. Driver-defined locks may not be held across calls to this function.
The caller cannot have the stream frozen [see freezestr(D3)] when calling this function.
| Home |
|---|
int putbq(queue_t *q, mblk_t *bp);
Arguments:
Return Values:
putbq returns 1 on success and 0 on failure.
Usage:
putbq is usually called when bcanput(D3) or canput(D3) [or, for multithreaded drivers, bcanputnext(D3) or canputnext(D3)] determines that the message cannot be passed on to the next stream component.
putbq can fail if there is not enough memory to allocate the accounting data structures used with messages whose priority bands are greater than zero.
High priority messages should never be put back on a queue from within
a service routine.
Level:
Base or Interrupt.
Synchronization Constraints:
Does not sleep. Driver-defined mask locks may be held across calls to this function.
The caller cannot have the stream frozen [see freezestr(D3)] when calling this function.
| Home |
|---|
int putctl(queue_t *q, int type);
Arguments:
Return Values:
On success, 1 is returned. Otherwise, if type is a data type,
or if a message block cannot be allocated, 0 is returned.
Usage:
In multithreaded drivers, the q argument may not reference q_next
(for example, an argument of q->q_next is erroneous in a multithreaded
driver and is disallowed by the DDI/DKI). putnextctl(q, type) is
provided as a multiprocessor-safe equivalent to the common call putctl(q->q_next,
type), which is no longer allowed.
Level:
Base or Interrupt.
Synchronization Constraints:
Does not sleep. Driver-defined basic locks, read/write locks, and sleep locks may not be held across calls to this function.
The caller cannot have the stream frozen [see freezestr(D3)] when calling this function..
| Home |
|---|
int putctl1(queue_t *q, int type, int param);
Arguments:
| q | Pointer to the queue to which the message is to be sent. |
| type | Message type (must be a control type). |
| param | One-byte parameter. |
Return Values:
Upon success, 1 is returned. Otherwise, if type is a data type,
or if a message block cannot be allocated, 0 is returned.
Usage:
In multithreaded drivers, the q argument to putctl1 and
putnextctl1(D3) may not reference
q_next (for example, an argument of q->q_next is erroneous in
a multithreaded driver and is disallowed by the DDI/DKI). putnextctl1(q,
type) is provided as a multiprocessor-safe equivalent to the common
call putctl1(q->q_next, type), which is no longer allowed.
Level:
Base or Interrupt.
Synchronization Constraints:
Does not sleep. Driver-defined locks may not be held across calls to this function.
The caller cannot have the stream frozen [see freezestr(D3)] when calling this function.
| Home |
|---|
int putnext(queue_t *q, mblk_t *mp);
DESCRIPTION
Arguments:
Return Values:
Ignored
Level:
Base or Interrupt.
Synchronization Constraints:
Does not sleep. Driver-defined locks may not be held across calls to this function.
The caller cannot have the stream frozen [see freezestr(D3)] when calling this function.
| Home |
|---|
Arguments:
Return Values:
Upon successful completion, putnextctl returns 1. If type
is a data type, or if a message block cannot be allocated, 0 is returned.
Usage:
In multithreaded drivers, the q argument to putctl(D3)
and putnextctl may not reference q_next (for example, an
argument of q->q_next is erroneous in a multithreaded driver and
is disallowed by the DDI/DKI). putnextctl(q, type) is provided as
a multiprocessor-safe equivalent to the common call putctl(q->q_next,
type), which is no longer allowed.
Level:
Base or Interrupt.
Synchronization Constraints:
Does not sleep. Driver-defined locks may not be held across calls to this function.
The caller cannot have the stream frozen [see freezestr(D3)] when calling this function.
| Home |
|---|
int putnextctl1(queue_t *q, int type, int param);
Arguments:
| q | Pointer to the queue from which the message is to be sent. |
| type | Message type (must be a control type). |
| param | One byte parameter |
Return Values:
Upon successful completion, putnextctl1 returns 1. If type
is a data type, or if a message block cannot be allocated, 0 is returned.
Usage:
In multithreaded drivers, the q argument to putctl1(D3)
and putnextctl1 may not reference q_next (for example, an
argument of q->q_next is erroneous in a multithreaded driver and
is disallowed by the DDI/DKI). putnextctl1(q, type) is provided
as a multiprocessor-safe equivalent to the common call putctl1(q->q_next,
type), which is no longer allowed.
Level:
Base or Interrupt.
Synchronization Constraints:
Does not sleep. Driver-defined locks may not be held across calls to this function.
The caller cannot have the stream frozen [see freezestr(D3)] when calling this function.
| Home |
|---|
int putq(queue_t *q, mblk_t *bp);
Arguments:
Return Values:
putq returns 1 on success and 0 on failure.
Usage:
putq can fail if there is not enough memory to allocate the accounting data structures used with messages whose priority bands are greater than zero.
Level:
Synchronization Constraints:
Does not sleep. Driver-defined mask locks may be held across calls to this function. In module, driver-defined locks must not be held.
The caller cannot have the stream frozen [see freezestr(D3)] when calling this function.
| Home |
|---|
void qenable(queue_t *q);
Arguments:
Return Values:
None
Usage:
qenable works regardless of whether the service routine has been
disabled by a prior call to noenable(D3).
Level:
Base or Interrupt.
Synchronization Constraints:
Does not sleep. Driver-defined mask locks may be held across calls to this function. In module, driver-defined locks must not be held.
The caller cannot have the stream frozen [see freezestr(D3)] when calling this function.
| Home |
|---|
void qprocsoff(queue_t *rq);
Arguments:
Return Values:
None
Usage:
qprocsoff must be called by the close(D2) routine of a
driver or module before deallocating any resources on which the driver/module's
put and service routines depend. Drivers or modules should
call qprocsoff exactly once to disable put and service
procedures. One additional effect of calling qprocsoff is that
both the read and write queues are flushed.
Level:
Base only.
Synchronization Constraints:
Can sleep. Driver-defined locks may not be held across calls to this function.
The caller cannot have the stream frozen [see freezestr(D3)] when calling this function.
| Home |
|---|
void qprocson(queue_t *rq);
Arguments:
Return Values:
None
Usage:
qprocson must be called by the first open of a module or driver
after allocation and initialization of any resources on which the put
and service routines depend. Modules or drivers should call
qprocson exactly once to enable put and service procedures.
qprocsoff is called (also exactly once) to disable these put
and service procedures.
Level:
Base only.
Synchronization Constraints:
Can sleep. Driver-defined locks may not be held across calls to this function.
The caller cannot have the stream frozen [see freezestr(D3)] when calling this function.
| Home |
|---|
void qreply(queue_t *q, mblk_t *bp);
Arguments:
Return Values:
None
Level
Base or Interrupt.
Synchronization Constraints:
Does not sleep. Driver-defined locks may not be held across calls to this function.
The caller cannot have the stream frozen [see freezestr(D3)] when calling this function.
| Home |
|---|
int qsize(queue_t *q);
Arguments:
Return Values:
If there are no messages on the queue, qsize returns 0. Otherwise,
it returns the number of messages on the queue.
Level:
Base or Interrupt.
Synchronization Constraints:
Does not sleep. Driver-defined mask locks and simple locks may be held across calls to this function. In module, driver-defined locks must not be held.
The caller cannot have the stream frozen [see freezestr(D3)] when calling this function.
| Home |
|---|
queue_t *RD(queue_t *q);
Arguments:
Return Values:
The pointer to the read queue.
Usage:
Note that when RD is passed a read queue pointer as an argument,
it returns a pointer to this read queue.
Level:
Base or Interrupt.
Synchronization Constraints:
Does not sleep. Driver-defined mask locks and simple locks may be held across calls to this function.
| Home |
|---|
mblk_t *rmvb(mblk_t *mp, mblk_t *bp);
Arguments:
Return Values:
On success, a pointer to the message (minus the removed block) is returned.
If bp was the only block in the message before rmvb was called,
NULL is returned. If the designated message block (bp) was
not in the message, _1 is returned.
Usage:
The message block is not freed, merely removed from the message. It
is the caller's responsibility to free the message block.
Level:
Base or Interrupt.
Synchronization Constraints:
Does not sleep. Driver-defined mask locks and simple locks may be held across calls to this function.
| Home |
|---|
void rmvq(queue_t *q, mblk_t *mp);
Arguments:
Return Values:
None
Usage:
A message can be removed from anywhere in a queue. To prevent modules
and drivers from having to deal with the internals of message linkage on
a queue, either rmvq or getq(D3)
should be used to remove a message from a queue.
Level:
Base or Interrupt.
Synchronization Constraints:
Does not sleep. Driver-defined mask locks, read/write locks, and sleep locks may be held across calls to this function. In module, driver-defined locks must not be held.
The caller cannot have the stream frozen [see freezestr(D3)] when calling this function.
| mp must point to an existing message in the queue pointed to by q, or a system panic will occur. |
| Home |
|---|
int SAMESTR(queue_t *q);
Arguments:
Return Values:
SAMESTR returns 1 if the next queue is of the same type as the
current queue. It returns 0 if the next queue does not exist or if it is
not of the same type.
Usage:
This function can be used to determine the point in a STREAMS-based pipe where a read queue is linked to a write queue.
In multithreaded drivers, the q argument may not reference q_next
(for example, an argument of q->q_next is erroneous in a multithreaded
driver and is disallowed by the DDI/DKI).
Level:
Base or Interrupt.
Synchronization Constraints:
Does not sleep. Driver-defined mask locks and simple locks may be held across calls to this function. In module, driver-defined locks must not be held.
The caller cannot have the stream frozen [see freezestr(D3)] when calling this function.
| Home |
|---|
int strqget(queue_t *q, qfields_t what, uchar_t pri, long *valp);
Arguments:
Return Values:
Upon success, 0 is returned. An error number is returned on failure.
The actual value of the requested field is returned through the reference
parameter, valp.
Usage:
| QHIWAT | High water mark of the specified priority band. |
| QLOWAT | Low water mark of the specified priority band. |
| QMAXPSZ | Maximum packet size of the specified priority band. |
| QMINPSZ | Minimum packet size of the specified priority band. |
| QCOUNT | Number of bytes of data in messages in the specified priority band. |
| QFIRST | Pointer to the first message in the specified priority band. |
| QLAST | Pointer to the last message in the specified priority band. |
| QFLAG | Flags for the specified priority band [see queue(D4)]. |
Level:
Base or Interrupt.
Synchronization Constraints:
Does not sleep. Driver-defined mask locks and simple locks may be held across calls to this function.
The caller must have the stream frozen [see freezestr(D3)] when calling this function.
| Home |
|---|
int strqset(queue_t *q, qfields_t what, uchar_t pri, long val);
Arguments:
Return Values:
Upon success, 0 is returned. An error number is returned on failure.
Usage:
| QHIWAT | High water mark of the specified priority band. |
| QLOWAT | Low water mark of the specified priority band. |
| QMAXPSZ | Maximum packet size of the specified priority band. |
| QMINPSZ | Minimum packet size of the specified priority band. |
Level:
Base or Interrupt.
Synchronization Constraints:
Does not sleep. Driver-defined mask locks and simple locks may be held across calls to this function.
The caller must have the stream frozen [see freezestr(D3)] when calling this function.
| Home |
|---|
#include <sys/stream.h>
void unbufcall(toid_t id);
Arguments:
Return Values:
None.
Usage:
On uniprocessor systems, if unbufcall is called while any function called by the pending bufcall or esbbcall request is running, the call to unbufcall has no effect.
On multiprocessor systems, if unbufcall is called while any function
called by the pending bufcall or esbbcall request is running,
the call to unbufcall will not return until the function completes.
Level:
Base or Interrupt.
Synchronization Constraints:
Does not sleep. Driver-defined mask locks may be held across calls to this function.
| Home |
|---|
void unfreezestr(queue_t *q, int pl);
Arguments:
Return Values:
None.
Usage:
pl should be the value that was returned from the corresponding
call to freezestr(D3).
Level:
Base or Interrupt.
Synchronization Constraints:
Does not sleep. Driver-defined mask locks may be held across calls to this function.
| Home |
|---|
mblk_t *unlinkb( mblk_t *mp);
Arguments:
Return Values:
unlinkb returns a pointer to the remainder of the message after
the first message block has been removed. If there is only one message
block in the message, NULL is returned.
Usage:
The removed message block is not freed. It is the caller's responsibility
to free it.
Level:
Base or Interrupt.
Synchronization Constraints:
Does not sleep. Driver-defined mask locks and simple locks may be held across calls to this function.
| Home |
|---|
queue_t *WR(queue_t *q);
Arguments:
Return Values:
The pointer to the write queue.
Usage:
Note that when WR is passed a write queue pointer as an argument,
it returns a pointer to this write queue.
Level:
Base or Interrupt.
Synchronization Constraints:
Does not sleep. Driver-defined mask locks and simple locks may be held across calls to this function.
| Home |
|---|
| Contents | Previous Chapter | Index | Glossary |