xref: /illumos-gate/usr/src/man/man9f/getq.9f (revision b70bf3ee79d81df3ccc36e553e0ff11049a2b51a)
te
Copyright (c) 2006, Sun Microsystems, Inc. All Rights Reserved.
Copyright 1989 AT&T
The contents of this file are subject to the terms of the Common Development and Distribution License (the "License"). You may not use this file except in compliance with the License.
You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE or http://www.opensolaris.org/os/licensing. See the License for the specific language governing permissions and limitations under the License.
When distributing Covered Code, include this CDDL HEADER in each file and include the License file at usr/src/OPENSOLARIS.LICENSE. If applicable, add the following below this CDDL HEADER, with the fields enclosed by brackets "[]" replaced with your own identifying information: Portions Copyright [yyyy] [name of copyright owner]
GETQ 9F "Jan 16, 2006"
NAME
getq - get the next message from a queue
SYNOPSIS

#include <sys/stream.h>



mblk_t *getq(queue_t *q);
INTERFACE LEVEL

Architecture independent level 1 (DDI/DKI).

PARAMETERS
q

Pointer to the queue from which the message is to be retrieved.

DESCRIPTION

The getq() function is used by a service ( srv(9E)) routine to retrieve its enqueued messages.

A module or driver may include a service routine to process enqueued messages. Once the STREAMS scheduler calls srv() it must process all enqueued messages, unless prevented by flow control. getq() obtains the next available message from the top of the queue pointed to by q. It should be called in a while loop that is exited only when there are no more messages or flow control prevents further processing.

If an attempt was made to write to the queue while it was blocked by flow control, getq() back-enables (restarts) the service routine once it falls below the low water mark.

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.

CONTEXT

The getq() function can be called from user, interrupt, or kernel context.

EXAMPLES

See dupb(9F).

SEE ALSO

srv (9E), bcanput (9F), canput (9F), dupb (9F), putbq (9F), putq (9F), qenable (9F)

Writing Device Drivers

STREAMS Programming Guide