STREAMS-UX Programmer's Guide (February 2007)

STREAMS Utilities Supported by HP-UX
Appendix B
180
NAME
getq () – gets the next message from the head of the queue.
SYNOPSIS
#include <sys/stream.h>
mblk_t *getq(queue_t *q);
PARAMETERS
q
Pointer to the queue from which the message is to be retrieved.
DESCRIPTION
getq() is used typically by the service procedure of a module/driver to retrieve the messages from the
message queue.
RETURN VALUES
If there is a message left in the queue to be retrieved, getq returns a pointer to that message. If there are no
messages in the queue, then getq() returns NULL and the queue is marked with QWANTR so that next time
when a message is placed on the queue, it will be scheduled for service. If the data in the enqueued messages
in the queue drops below the low water mark then queue behind the current queue is scheduled for service, if
the backq previously attempted to place a message and failed.
CONSTRAINTS
getq() can be called from thread or interrupt context. Only spinlocks of STREAMS/UX user lock order can be
held across this call.