'\"macro stdmacro
.if n .pH ddi_dki.WR @(#)WR	40.5 of 10/10/89
.\" Copyright 1989 AT&T
.de IX
.ie '\\n(.z'' .tm .Index: \\$1 \\$2 \\$3 \\$4 \\$5 \\$6 \\$7 \\$8 \\$9	\\n%
.el \\!.IX \\$1 \\$2 \\$3 \\$4 \\$5 \\$6 \\$7 \\$8 \\$9
..
.nr X
.if \nX=0 .ds x} WR D3DK "STREAMS" "DDI/DKI" "\&"
.if \nX=1 .ds x} WR D3DK "STREAMS" "DDI/DKI"
.if \nX=2 .ds x} WR D3DK "" "\&"
.if \nX=3 .ds x} WR "" "" "\&"
.TH \*(x}
.IX "\f4WR\fP(D3DK)"
.SH NAME
\f4WR\f1 \- get pointer to the write queue for this module or driver
.SH SYNOPSIS
.nf
.na
\f4#include <sys/stream.h>
#include <sys/ddi.h>
.sp 0.5
queue_t WR(queue_t *\f2q\f4);\f1
.ad
.fi
.SH ARGUMENTS
.RS 0n 10
.IP "\f2q\f1" 10n
Pointer to the \f2read\f1 queue whose \f2 write\f1 queue is to be
returned.
.RE
.SH DESCRIPTION
The \f4WR\f1 function accepts a \f2read\f1 queue pointer as an argument and
returns a pointer to the \f2write\f1 queue of the same module.
.P
\f3CAUTION:\f1
Make sure the argument to this function is a pointer to a
\f2read\f1 queue. \f4WR\f1 will not check for queue type, and a system
panic could result if the pointer is not to a \f2read\f1 queue.
.SH "RETURN VALUE" 
The pointer to the \f2write\f1 queue.
.SH LEVEL 
Base or Interrupt
.SH "SEE ALSO" 
\f2STREAMS Programmer's Guide\f1
.P
.na
\f4OTHERQ\f1(D3DK),
\f4RD\f1(D3DK)
.ad
.SH EXAMPLE 
.IX "\f4WR\fP(D3DK), example"
.P
In a STREAMS \f4close\f1 routine, the driver or module is passed
a pointer to the read queue.  The driver must zero out
the \f4q_ptr\f1 field of both the read and write queues if it
had previously initialized them in its \f4open\f1 routine.  These
usually are set to the address of the module-specific data
structure for the minor device.
.ne 4
.P
.nf
.ft 4
.ps 7
 1  xxxclose(q, flag)
 2      queue_t *q;
 3      int flag;
 4  {
 5	q->q_ptr = NULL;
 6	WR(q)->q_ptr = NULL;
	. . .
 7  }
.ps
.ft 1
.fi
.P
