'\"macro stdmacro
.if n .pH ddi_dki.freeb @(#)freeb	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} freeb D3DK "STREAMS" "DDI/DKI" "\&"
.if \nX=1 .ds x} freeb D3DK "STREAMS" "DDI/DKI"
.if \nX=2 .ds x} freeb D3DK "" "\&"
.if \nX=3 .ds x} freeb "" "" "\&"
.TH \*(x}
.SH NAME
.IX "\f4freeb\fP(D3DK)"
.IX "STREAMS message blocks"
\f4freeb\f1 \- free a message block
.SH SYNOPSIS
.nf
.na
\f4#include <sys/stream.h>
.sp 0.5
void freeb(mblk_t *\f2bp\f4);\f1
.ad
.fi
.SH ARGUMENTS
.RS 0n
.IP "\f2bp\f1" 10n
Pointer to the message block to be deallocated.
\f4mblk_t\f1 is an instance
of the \f4msgb\f1(D4DK) structure.
.RE
.SH DESCRIPTION
\f4freeb\f1 deallocates a message block.
If the reference count of the \f4db_ref\f1 member of the 
\f4datab\f1(D4DK) structure
is greater than \f41\f1, \f4freeb\f1 decrements the count.
If \f4db_ref\f1 equals \f41\f1, 
it deallocates the message block and the
corresponding data block and buffer.
.P
If the data buffer to be freed was allocated with the \f4esballoc\f1(D3DK)
function, the buffer may be a non-STREAMS resource.
In that case, the driver must be notified that the attached data buffer
needs to be freed, and run its own freeing routine.
To make this process independent of the driver used in the stream,
\f4freeb\f1 finds the \f4free_rtn\f1(D4DK) structure associated with
the buffer.
The \f4free_rtn\f1(D4DK) structure contains a pointer to the
driver-dependent routine, which releases the buffer.
Once this is accomplished, \f4freeb\f1 releases the STREAMS resources
associated with the buffer.
.SH RETURN VALUE
None
.SH LEVEL
Base or Interrupt
.SH SEE ALSO
\f2BCI Driver Development Guide\f1, Chapter 7, ``STREAMS''
.P
.na
\f4allocb\f1(D3DK),
\f4dupb\f1(D3DK),
\f4esballoc\f1(D3DK),
\f4free_rtn\f1(D4DK)
.ad
.SH EXAMPLE
See the \f4copyb\f1(D3DK) function page for an example of \f4freeb\f1.
