STREAMS-UX Programmer's Guide (February 2007)
Messages
Message Processing and Flow Control
Chapter 3
57
The flow control parameters for the q specified are updated.
insq () Returns 1 on success. Otherwise it returns 0.
mblk_t *getq(queue_t *q)
getq () Returns the next available message from the message queue associated with the q. This is
typically used by the service procedure to process the messages. If there are no messages,
this routine will return a NULL pointer and QWANTR is set so when the next message is
placed, the service procedure will be scheduled. It updates the flow control parameters.
int putbq(queue_t *q, mblk_t *mp)
putbq () Returns a message mp back to the beginning of the queue pointed at by q. The position of
the mp depends on the message type. The flow control parameters are updated and the
service procedure is scheduled in accordance with the same set of rules mentioned in putq
().
A service procedure must not use putbq () for high priority messages.
The putbq () utility returns 1 on success and 0 on failure.
void flushq(queue_t *q, int flag)
flushq () Removes the message from the message queue associated with the q. If the flag is set to
FLUSHDATA, flushq () frees all the M_DATA, M_PROTO, M_PCPROTO, and M_DELAY messages.
FLUSHALL will result in flushing all messages in the message queue. The flow control
parameters are updated for this queue and the nearest service procedure is enabled if
QWANTW is set.
void flushband(queue_t *q, int pri, int flag)
flushband () Will free the message associated with a given priority band as specified in the pri
parameter. If the pri is set to 0, then only the normal messages are freed according to the
value of flag. Otherwise, messages are flushed from the band specified by pri. The
FLUSHDATA & FLUSHALL are the valid bitmasks for the flag parameter.
If the value of pri is greater than q_nband then flushband () routine simply returns to the
user without flushing any messages on the queue.
The flow control parameters are updated corresponding to this queue and the nearest
service procedure is enabled if QWANTW is set.
void qenable(queue_t *q)
qenable () Provides a mechanism for drivers/modules to enable service procedure to run. It inserts
the q into the linked list of queues that are ready to be invoked by the STREAMS scheduler.
int canput(queue_t *q)
canput () Checks to see if additional messages can be enqu1230.ued onto the message queue
correspond to q. It returns 1 if queue is not full, otherwise it returns 0.
int bcanput(queue_t *q, int pri)
bcanput () Checks the flow control for the given priority band. It returns 1 if a message of priority pri
can be placed on the message queue, otherwise it returns 0.