'\"macro stdmacro
.if n .pH ddi_dki.rmvq @(#)rmvq	40.6 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} rmvq D3DK "STREAMS" "DDI/DKI" "\&"
.if \nX=1 .ds x} rmvq D3DK "STREAMS" "DDI/DKI"
.if \nX=2 .ds x} rmvq D3DK "" "\&"
.if \nX=3 .ds x} rmvq "" "" "\&"
.TH \*(x}
.IX "\f4rmvq\fP(D3DK)"
.SH NAME
\f4rmvq\f1 \- remove a message from a queue
.SH SYNOPSIS
.nf
.na
\f4#include <sys/stream.h>
.sp 0.5
void rmvq(queue_t *\f2q, \f4mblk_t \f2*mp\f4);\f1
.ad
.fi
.SH ARGUMENTS
.RS 0n 10
.IP "\f2q\f1" 10n
Queue containing the message to be removed.
.IP "\f2mp\f1" 10n
Message to remove.
.RE
.SH DESCRIPTION
\f4rmvq\f1 removes a message from a queue.
A message can be removed from anywhere on a queue.
To prevent modules and drivers from having to deal with the
internals of message linkage on a queue, either \f4rmvq\f1 or
\f4getq\f1(D3DK) should be used to remove a message from a queue.
.P
\f3CAUTION:\f1
Make sure that the message \f2mp\f1 exists to avoid a
possible system panic.
.SH RETURN VALUE
None
.SH LEVEL
Base or Interrupt
.SH SEE ALSO
\f2BCI Driver Development Guide\f1, Chapter 7, ``STREAMS''
.SH EXAMPLE
.IX "\f4freemsg\fP(D3DK), example"
.IX "\f4rmvq\fP(D3DK), example"
.IX "\f4msgb\fP(D4DK), example"
.IX "\f4queue\fP(D4DK), example"
.P
This code fragment illustrates how one may flush
one type of message from a queue.  In this case, only
\f4M_PROTO T_DATA_IND\f1 messages are flushed.  For each
message on the queue, if it is an \f4M_PROTO\f1 message (line 8) of
type \f4T_DATA_IND\f1 (line 10), 
save a pointer to the next message (line 11),
remove the \f4T_DATA_IND\f1 message (line 12) and free it (line 13).
Continue with the next message in the list (line 19).
.P
.ne 4
.P
.nf
.ft 4
.ps 7
 1  mblk_t *mp;
 2  mblk_t *nmp;
 3  queue_t *q;
 4  union T_primitives *tp;
 5
 6  mp = q->q_first;
 7  while (mp) {
 8	if (mp->b_datap->db_type == M_PROTO) {
 9		tp = (union T_primitives *)mp->b_rptr;
10		if (tp->type == T_DATA_IND) {
11			nmp = mp->b_next;
12			rmvq(q, mp);
13			freemsg(mp);
14			mp = nmp;
15		} else {
16			mp = mp->b_next;
17		}
18	} else {
19		mp = mp->b_next;
20	}
21  }
.ps
.ft 1
.fi
.P
.FG "rmvq \- remove message from queue"
