Merge commit '9276b3991ba20d5a5660887ba81b0bc7bed25a0c'
[unleashed.git] / share / man / man9f / putbq.9f
blobc6809fcf84c88f66db5b2c0ce122333ada484521
1 '\" te
2 .\"  Copyright 1989 AT&T
3 .\"  Copyright (c) 2006, Sun Microsystems, Inc.,  All Rights Reserved
4 .\" 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.
5 .\" 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.
6 .\" 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]
7 .TH PUTBQ 9F "Jan 16, 2006"
8 .SH NAME
9 putbq \- place a message at the head of a queue
10 .SH SYNOPSIS
11 .LP
12 .nf
13 #include <sys/stream.h>
17 \fBint\fR \fBputbq\fR(\fBqueue_t *\fR\fIq\fR, \fBmblk_t *\fR\fIbp\fR);
18 .fi
20 .SH INTERFACE LEVEL
21 .sp
22 .LP
23 Architecture independent level 1 (DDI/DKI).
24 .SH PARAMETERS
25 .sp
26 .ne 2
27 .na
28 \fB\fIq\fR\fR
29 .ad
30 .RS 6n
31 Pointer to the queue.
32 .RE
34 .sp
35 .ne 2
36 .na
37 \fB\fIbp\fR\fR
38 .ad
39 .RS 6n
40 Pointer to the message block.
41 .RE
43 .SH DESCRIPTION
44 .sp
45 .LP
46 The \fBputbq()\fR function places a message at the beginning of the appropriate
47 section of the message queue. There are always sections for high priority and
48 ordinary messages. If other priority bands are used, each will have its own
49 section of the queue, in priority band order, after high priority messages and
50 before ordinary messages. \fBputbq()\fR can be used for ordinary, priority
51 band, and high priority messages. However, unless precautions are taken, using
52 \fBputbq()\fR with a high priority message is likely to lead to an infinite
53 loop of putting the message back on the queue, being rescheduled, pulling it
54 off, and putting it back on.
55 .sp
56 .LP
57 This function is usually called when \fBbcanput\fR(9F) or \fBcanput\fR(9F)
58 determines that the message cannot be passed on to the next stream component.
59 The flow control parameters are updated to reflect the change in the queue's
60 status. If \fBQNOENB\fR is not set, the service routine is enabled.
61 .SH RETURN VALUES
62 .sp
63 .LP
64 The \fBputbq()\fR function returns \fB1\fR upon success and \fB0\fR upon
65 failure.
66 .sp
67 .LP
68 Upon failure, the caller should call \fBfreemsg\fR(9F) to free the pointer to
69 the message block.
70 .SH CONTEXT
71 .sp
72 .LP
73 The \fBputbq()\fR function can be called from user, interrupt, or kernel
74 context.
75 .SH EXAMPLES
76 .sp
77 .LP
78 See the \fBbufcall\fR(9F) function page for an example of \fBputbq()\fR.
79 .SH SEE ALSO
80 .sp
81 .LP
82 \fBbcanput\fR(9F), \fBbufcall\fR(9F), \fBcanput\fR(9F), \fBgetq\fR(9F),
83 \fBputq\fR(9F)
84 .sp
85 .LP
86 \fIWriting Device Drivers\fR
87 .sp
88 .LP
89 \fISTREAMS Programming Guide\fR