1freeb(9F)                Kernel Functions for Drivers                freeb(9F)
2
3
4

NAME

6       freeb - free a message block
7

SYNOPSIS

9       #include <sys/stream.h>
10
11
12
13       void freeb(mblk_t *bp);
14
15

PARAMETERS

17       bp    Pointer  to  the  message  block  to be deallocated. mblk_t is an
18             instance of the msgb(9S) structure.
19
20

INTERFACE LEVEL

22       Architecture independent level 1 (DDI/DKI).
23

DESCRIPTION

25       The freeb() function deallocates a  message  block.  If  the  reference
26       count  of  the db_ref member of the datab(9S) structure is greater than
27       1, freeb() decrements the count. If db_ref equals 1, it deallocates the
28       message block and the corresponding data block and buffer.
29
30
31       If the data buffer to be freed was allocated with the esballoc(9F), the
32       buffer may be a non-STREAMS resource. In that case, the driver must  be
33       notified  that  the attached data buffer needs to be freed, and run its
34       own freeing routine. To make this process  independent  of  the  driver
35       used in the stream, freeb() finds the free_rtn(9S) structure associated
36       with the buffer. The free_rtn  structure  contains  a  pointer  to  the
37       driver-dependent  routine,  which  releases  the  buffer.  Once this is
38       accomplished, freeb() releases the STREAMS  resources  associated  with
39       the buffer.
40

CONTEXT

42       The freeb() function can be called from user, interrupt, or kernel con‐
43       text.
44

EXAMPLES

46       Example 1 Using freeb()
47
48
49       See copyb(9F) for an example of using freeb().
50
51

SEE ALSO

53       allocb(9F), copyb(9F), dupb(9F), esballoc(9F), free_rtn(9S)
54
55
56       Writing Device Drivers
57
58
59       STREAMS Programming Guide
60
61
62
63SunOS 5.11                        16 Jan 2006                        freeb(9F)
Impressum