1
0
Files
irix-657m-src/eoe/man/manD/rmvb.d3
2022-09-29 17:59:04 +03:00

85 lines
2.2 KiB
Plaintext

.if n .pH ddi.rm/d3/gen/rmvb @(#)rmvb 43.9 of 11/27/92
.\" Copyright 1992, 1991 UNIX System Laboratories, Inc.
.TH rmvb D3
.IX "\f4rmvb\fP(D3)"
.SH NAME
\f4rmvb\f1 \- remove a message block from a message
.SH SYNOPSIS
.nf
.na
.ft 4
#include <sys/stream.h>
#include <sys/ddi.h>
.sp 0.4
mblk_t *rmvb(mblk_t *\f2mp\fP, mblk_t *\f2bp\fP);
.ft 1
.ad
.fi
.SS Arguments
.RS 0
.IP "\f2mp\f1" 10n
Pointer to the message from which a message block is to be removed.
.IP "\f2bp\f1" 10n
Pointer to the message block to be removed.
.RE
.SH DESCRIPTION
\f4rmvb\f1 removes the message block specified by \f2bp\f1
from the message specified \f2mp\f1
and returns a pointer to the altered message.
.SS "Return Values"
On success, a pointer to the message (minus the removed block) is returned.
If \f2bp\f1 was the only block in the message before \f4rmvb\f1 was called,
\f4NULL\fP is returned.
If the designated message block (\f2bp\f1) was not in the message, \-1 is
returned.
.SH USAGE
The message block is not freed, merely removed from the message.
It is the caller's responsibility to free the message block.
.SS Level
Base or Interrupt.
.SS "Synchronization Constraints"
Does not sleep.
.P
Driver-defined basic locks, read/write locks, and sleep locks
may be held across calls to this function.
.SS Examples
This routine removes all zero-length \f4M_DATA\f1 message blocks
from the given message. For each message block in the message, we
save the next message block (line 9).
If the current message block is
of type \f4M_DATA\f1 and has no data in its buffer (lines 10\-11), then we remove
the message block from the message (line 12) and free it (line 13).
In either case, we continue with
the next message block (line 15), until we have checked every message
block in the message.
.ne 4
.P
.nf
.ft 4
.ps 9
.vs 11
1 void
2 xxclean(mp)
3 mblk_t *mp;
4 {
5 mblk_t *tmp;
6 mblk_t *nmp;
.sp 0.4
7 tmp = mp;
8 while (tmp) {
9 nmp = tmp->b_next;
10 if ((tmp->b_datap->db_type == M_DATA) &&
11 (tmp->b_rptr == tmp->b_wptr)) {
12 mp = rmvb(mp, tmp);
13 freeb(tmp);
14 }
15 tmp = nmp;
16 }
17 }
.vs
.ps
.ft 1
.fi
.IX "\f4freeb\fP(D3), example"
.IX "\f4rmvb\fP(D3), example"