Gets a message from a queue.
mblk_t * getq(q) register queue_t *q;
The getq utility gets the next available message from the queue pointed to by the q parameter. The getq utility returns a pointer to the message and removes that message from the queue. If no message is queued, the getq utility returns null.
The getq utility, and certain other utility routines, affect flow control in the Stream as follows: If the getq utility returns null, the queue is marked with the QWANTR flag so that the next time a message is placed on it, it will be scheduled for service (that is, enabled - see the qenable utility). If the data in the enqueued messages in the queue drops below the low-water mark, as specified by the q _ lowat field, and if a queue behind the current queue has previously attempted to place a message in the queue and failed, (that is, was blocked - see the canput utility), then the queue behind the current queue is scheduled for service.
The queue count is maintained on a per-band basis. Priority band 0 (normal messages) uses the q _ count and q _ lowat fields. Nonzero priority bands use the fields in their respective qband structures (the qb _ count and qb _ lowat fields). All messages appear on the same list, linked according to their b _ next pointers.
The q _ count field does not reflect the size of all messages on the queue; it only reflects those messages in the normal band of flow.
|Specifies the queue from which to get the message.
On successful completion, the getq utility returns a pointer to the message. Otherwise, it returns a null value.
This utility is part of STREAMS Kernel Extensions.
The canput utility, qenable utility, rmvq utility.
List of Streams Programming References and Understanding STREAMS Messages in AIX Version 4.3 Communications Programming Concepts.