1getrbuf(9F) Kernel Functions for Drivers getrbuf(9F)
2
3
4
6 getrbuf - get a raw buffer header
7
9 #include <sys/buf.h>
10 #include <sys/kmem.h>
11 #include <sys/ddi.h>
12
13
14
15 struct buf *getrbuf(int sleepflag);
16
17
19 Architecture independent level 1 (DDI/DKI).
20
22 sleepflag Indicates whether driver should sleep for free space.
23
24
26 The getrbuf() function allocates the space for a buffer header to the
27 caller. It is used in cases where a block driver is performing raw
28 (character interface) I/O and needs to set up a buffer header that is
29 not associated with the buffer cache.
30
31
32 The getrbuf() function calls kmem_alloc(9F) to perform the memory allo‐
33 cation. kmem_alloc()requires the information included in the sleepflag
34 argument. If sleepflag is set to KM_SLEEP, the driver may sleep until
35 the space is freed up. If sleepflag is set to KM_NOSLEEP, the driver
36 will not sleep. In either case, a pointer to the allocated space is
37 returned or NULL to indicate that no space was available.
38
40 The getrbuf() function returns a pointer to the allocated buffer
41 header, or NULL if no space is available.
42
44 The getrbuf() function can be called from user, interrupt, or kernel
45 context. (Drivers must not allow getrbuf() to sleep if called from an
46 interrupt routine.)
47
49 bioinit(9F), freerbuf(9F), kmem_alloc(9F), kmem_free(9F)
50
51
52 Writing Device Drivers
53
54
55
56SunOS 5.11 16 Jan 2006 getrbuf(9F)