Merge commit '9276b3991ba20d5a5660887ba81b0bc7bed25a0c'
[unleashed.git] / share / man / man9f / putnextctl1.9f
blob6e6a2144886ccc5e552f5be281c8ff77424a8347
1 '\" te
2 .\"  Copyright 1989 AT&T
3 .\"  Copyright (c) 2006, Sun Microsystems, Inc.,
4 .\"  All Rights Reserved
5 .\" 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.
6 .\" 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.
7 .\" 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]
8 .TH PUTNEXTCTL1 9F "Jan 16, 2006"
9 .SH NAME
10 putnextctl1 \- send a control message with a one-byte parameter to a queue
11 .SH SYNOPSIS
12 .LP
13 .nf
14 #include <sys/stream.h>
18 \fBint\fR \fBputnextctl1\fR(\fBqueue_t *\fR\fIq\fR, \fBint\fR \fItype\fR, \fBint\fR \fIp\fR);
19 .fi
21 .SH INTERFACE LEVEL
22 .sp
23 .LP
24 Architecture independent level 1 (DDI/DKI).
25 .SH PARAMETERS
26 .sp
27 .ne 2
28 .na
29 \fB\fIq\fR\fR
30 .ad
31 .RS 8n
32 Queue to which the message is to be sent.
33 .RE
35 .sp
36 .ne 2
37 .na
38 \fB\fItype\fR\fR
39 .ad
40 .RS 8n
41 Type of message.
42 .RE
44 .sp
45 .ne 2
46 .na
47 \fB\fIp\fR\fR
48 .ad
49 .RS 8n
50 One-byte parameter.
51 .RE
53 .SH DESCRIPTION
54 .sp
55 .LP
56 The \fBputnextctl1()\fR function, like \fBputctl1\fR(9F), tests the \fItype\fR
57 argument to make sure a data type has not been specified, and attempts to
58 allocate a message block. The \fIp\fR parameter can be used, for example, to
59 specify how long the delay will be when an \fBM_DELAY\fR message is being sent.
60 \fBputnextctl1()\fR fails if \fItype\fR is \fBM_DATA\fR, \fBM_PROTO\fR, or
61 \fBM_PCPROTO\fR, or if a message block cannot be allocated. If successful,
62 \fBputnextctl1()\fR calls the \fBput\fR(9E) routine of the queue pointed to by
63 \fIq\fR with the newly allocated and initialized message.
64 .sp
65 .LP
66 A call to \fBputnextctl1(\fR\fIq\fR,\fItype, p\fR\fB)\fR is an atomic
67 equivalent of \fBputctl1(\fR\fIq\fR\fB->q_next,\fR \fItype, p\fR\fB).\fR The
68 STREAMS framework provides whatever mutual exclusion is necessary to insure
69 that dereferencing \fIq\fR through its \fBq_next\fR field and then invoking
70 \fBputctl1\fR(9F) proceeds without interference from other threads.
71 .sp
72 .LP
73 The \fBputnextctl1()\fR function should always be used in preference to
74 \fBputctl1\fR(9F)
75 .SH RETURN VALUES
76 .sp
77 .LP
78 On success, \fB1\fR is returned. \fB0\fR is returned if \fItype\fR is a data
79 type, or if a message block cannot be allocated.
80 .SH CONTEXT
81 .sp
82 .LP
83 The \fBputnextctl1()\fR function can be called from user, interrupt, or kernel
84 context.
85 .SH EXAMPLES
86 .sp
87 .LP
88 See the \fBputnextctl\fR(9F) function page for an example of
89 \fBputnextctl1()\fR.
90 .SH SEE ALSO
91 .sp
92 .LP
93 \fBput\fR(9E), \fBallocb\fR(9F), \fBdatamsg\fR(9F), \fBputctl1\fR(9F),
94 \fBputnextctl\fR(9F)
95 .sp
96 .LP
97 \fIWriting Device Drivers\fR
98 .sp
99 .LP
100 \fISTREAMS Programming Guide\fR