Kernel Functions for Drivers freeb(9F)
NAME
freeb - free a message block
SYNOPSIS
#include
void freeb(mblkt *bp);
PARAMETERS
bp Pointer to the message block to be deallocated. mblkt
is an instance of the msgb(9S) structure.
INTERFACE LEVEL
Architecture independent level 1 (DI/DKI).
DESCRIPTION
The freeb() function deallocates a message block. If the
reference count of the dbref member of the datab(9S) struc-
ture is greater than 1, freeb() decrements the count. If
dbref equals 1, it deallocates the message block and the
corresponding data block and buffer.
If the data buffer to be freed was allocated with the
esballoc(9F), 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 rou-
tine. To make this process independent of the driver used in
the stream, freeb() finds the freertn(9S) structure associ-
ated with the buffer. The freertn structure contains a
pointer to the driver-dependent routine, which releases the
buffer. Once this is accomplished, freeb() releases the
STREAMS resources associated with the buffer.
CONTEXT
The freeb() function can be called from user, interrupt, or
kernel context.
EXAMPLES
Example 1 Using freeb()
See copyb(9F) for an example of using freeb().
SEE ALSO
allocb(9F), copyb(9F), dupb(9F), esballoc(9F), freertn(9S)
SunOS 5.11 Last change: 16 Jan 2006 1
Kernel Functions for Drivers freeb(9F)
Writing Device Drivers
STREAMS Programming Guide
SunOS 5.11 Last change: 16 Jan 2006 2
|