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 QREPLY 9F "Jan 16, 2006"
9 qreply \- send a message on a stream in the reverse direction
13 #include <sys/stream.h>
17 \fBvoid\fR \fBqreply\fR(\fBqueue_t *\fR\fIq\fR, \fBmblk_t *\fR\fImp\fR);
23 Architecture independent level 1 (DDI/DKI).
40 Pointer to the message to be sent in the opposite direction.
46 The \fBqreply()\fR function sends messages in the reverse direction of normal
47 flow. That is, \fBqreply(\fR\fIq\fR\fB,\fR \fImp\fR\fB)\fR is equivalent to
48 \fBputnext(OTHERQ(\fR\fIq\fR\fB),\fR \fImp\fR\fB)\fR.
52 The \fBqreply()\fR function can be called from user, interrupt, or kernel
56 \fBExample 1 \fRCanonical Flushing Code for STREAMS Drivers.
59 This example depicts the canonical flushing code for STREAMS drivers. Assume
60 that the driver has service procedures so that there may be messages on its
61 queues. See \fBsrv\fR(9E). Its write-side put procedure handles \fBM_FLUSH\fR
62 messages by first checking the \fBFLUSHW\fR bit in the first byte of the
63 message, then the write queue is flushed (line 8) and the \fBFLUSHW\fR bit is
64 turned off (line 9). See \fBput\fR(9E). If the \fBFLUSHR\fR bit is on, then the
65 read queue is flushed (line 12) and the message is sent back up the read side
66 of the stream with the \fBqreply()\fR function (line 13). If the \fBFLUSHR\fR
67 bit is off, then the message is freed (line 15). See the example for
68 \fBflushq\fR(9F) for the canonical flushing code for modules.
77 5 switch(mp->b_datap->db_type) {
79 7 if (*mp->b_rptr & FLUSHW) {
80 8 flushq(q, FLUSHALL);
81 9 *mp->b_rptr &= ~FLUSHW;
83 11 if (*mp->b_rptr & FLUSHR) {
84 12 flushq(RD(q), FLUSHALL);
99 \fBput\fR(9E), \fBsrv\fR(9E), \fBflushq\fR(9F), \fBOTHERQ\fR(9F),
103 \fIWriting Device Drivers\fR
106 \fISTREAMS Programming Guide\fR