xref: /titanic_51/usr/src/man/man9f/putbq.9f (revision d583b39bfb4e2571d3e41097c5c357ffe353ad45)
te
Copyright 1989 AT&T
Copyright (c) 2006, Sun Microsystems, Inc., All Rights Reserved
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]
PUTBQ 9F "Jan 16, 2006"
NAME
putbq - place a message at the head of a queue
SYNOPSIS

#include <sys/stream.h>



int putbq(queue_t *q, mblk_t *bp);
INTERFACE LEVEL

Architecture independent level 1 (DDI/DKI).

PARAMETERS
q

Pointer to the queue.

bp

Pointer to the message block.

DESCRIPTION

The putbq() function places a message at the beginning of the appropriate section of the message queue. There are always sections for high priority and ordinary messages. If other priority bands are used, each will have its own section of the queue, in priority band order, after high priority messages and before ordinary messages. putbq() can be used for ordinary, priority band, and high priority messages. However, unless precautions are taken, using putbq() with a high priority message is likely to lead to an infinite loop of putting the message back on the queue, being rescheduled, pulling it off, and putting it back on.

This function is usually called when bcanput(9F) or canput(9F) determines that the message cannot be passed on to the next stream component. The flow control parameters are updated to reflect the change in the queue's status. If QNOENB is not set, the service routine is enabled.

RETURN VALUES

The putbq() function returns 1 upon success and 0 upon failure.

Upon failure, the caller should call freemsg(9F) to free the pointer to the message block.

CONTEXT

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

EXAMPLES

See the bufcall(9F) function page for an example of putbq().

SEE ALSO

bcanput(9F), bufcall(9F), canput(9F), getq(9F), putq(9F)

Writing Device Drivers

STREAMS Programming Guide