[ Previous | Next | Table of Contents | Index | Library Home | Legal | Search ]

Technical Reference: Communications, Volume 2


getq Utility

Purpose

Gets a message from a queue.

Syntax


mblk_t *
getq(q)
register queue_t * q;

Description

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.

Parameters


q Specifies the queue from which to get the message.

Return Values

On successful completion, the getq utility returns a pointer to the message. Otherwise, it returns a null value.

Implementation Specifics

This utility is part of STREAMS Kernel Extensions.

Related Information

The canput utility, qenable utility, rmvq utility.

List of Streams Programming References and Understanding STREAMS Messages in AIX 5L Version 5.1 Communications Programming Concepts.


[ Previous | Next | Table of Contents | Index | Library Home | Legal | Search ]