Merge commit '9276b3991ba20d5a5660887ba81b0bc7bed25a0c'
[unleashed.git] / share / man / man9f / freezestr.9f
blob116c842e7376fba1b17e8f500ce93f4eb71f3b51
1 '\" te
2 .\" Copyright (c) 2001, Sun Microsystems, Inc.
3 .\" 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.
4 .\" 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.
5 .\" 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]
6 .TH FREEZESTR 9F "Oct 17, 2000"
7 .SH NAME
8 freezestr, unfreezestr \- freeze, thaw the state of a stream
9 .SH SYNOPSIS
10 .LP
11 .nf
12 #include <sys/stream.h>
13 #include <sys/ddi.h>
17 \fBvoid\fR \fBfreezestr\fR(\fBqueue_t *\fR\fIq\fR);
18 .fi
20 .LP
21 .nf
22 \fBvoid\fR \fBunfreezestr\fR(\fBqueue_t *\fR\fIq\fR);
23 .fi
25 .SH INTERFACE LEVEL
26 .sp
27 .LP
28 Architecture independent level 1 (DDI/DKI).
29 .SH PARAMETERS
30 .sp
31 .ne 2
32 .na
33 \fB\fIq\fR \fR
34 .ad
35 .RS 6n
36 Pointer to the message queue to freeze/unfreeze.
37 .RE
39 .SH DESCRIPTION
40 .sp
41 .LP
42 \fBfreezestr()\fR freezes the state of the entire stream containing the queue
43 pair \fIq\fR. A frozen stream blocks any thread attempting to enter any open,
44 close, put or service routine belonging to any queue instance in the stream,
45 and blocks any thread currently within the stream if it attempts to put
46 messages onto or take messages off of any queue within the stream (with the
47 sole exception of the caller). Threads blocked by this mechanism remain so
48 until the stream is thawed by a call to \fBunfreezestr()\fR.
49 .sp
50 .LP
51 Drivers and modules must freeze the stream before manipulating the queues
52 directly (as opposed to manipulating them through programmatic interfaces such
53 as \fBgetq\fR(9F), \fBputq\fR(9F), \fBputbq\fR(9F), etc.)
54 .SH CONTEXT
55 .sp
56 .LP
57 These routines may be called from any stream open, close, put or service
58 routine as well as interrupt handlers, callouts and call-backs.
59 .SH SEE ALSO
60 .sp
61 .LP
62 \fIWriting Device Drivers\fR
63 .sp
64 .LP
65 \fISTREAMS Programming Guide\fR
66 .SH NOTES
67 .sp
68 .LP
69 The \fBfreezestr()\fR and \fBunfreezestr()\fR functions can have a serious
70 impact on system performance. Their use should be very limited. In most cases,
71 there is no need to use \fBfreezestr()\fR and there are usually better ways to
72 accomplish what you need to do than by freezing the stream.
73 .sp
74 .LP
75 Calling \fBfreezestr()\fR to freeze a stream that is already frozen by the
76 caller will result in a single-party deadlock.
77 .sp
78 .LP
79 The caller of \fBunfreezestr()\fR must be the thread who called
80 \fBfreezestr()\fR.
81 .sp
82 .LP
83 STREAMS utility functions such as \fBgetq\fR(9F), \fBputq\fR(9F),
84 \fBputbq\fR(9F), and so forth, should not be called by the caller of
85 \fBfreezestr()\fR while the stream is still frozen, as they indirectly freeze
86 the stream to ensure atomicity of queue manipulation.