1qbufcall(9F) Kernel Functions for Drivers qbufcall(9F)
2
3
4
6 qbufcall - call a function when a buffer becomes available
7
9 #include <sys/stream.h>
10 #include <sys/ddi.h>
11
12
13
14 bufcall_id_t qbufcall(queue_t *q, size_t size, uint_t pri,
15 void(*func)(void *arg), void *arg);
16
17
19 Solaris DDI specific (Solaris DDI).
20
22 q Pointer to STREAMS queue structure.
23
24
25 size Number of bytes required for the buffer.
26
27
28 pri Priority of the allocb(9F) allocation request (not used).
29
30
31 func Function or driver routine to be called when a buffer becomes
32 available.
33
34
35 arg Argument to the function to be called when a buffer becomes
36 available.
37
38
40 The qbufcall() function serves as a qtimeout(9F) call of indeterminate
41 length. When a buffer allocation request fails, qbufcall() can be used
42 to schedule the routine func to be called with the argument arg when a
43 buffer becomes available. func may call allocb() or it may do something
44 else.
45
46
47 The qbufcall() function is tailored to be used with the enhanced
48 STREAMS framework interface, which is based on the concept of perime‐
49 ters. (See mt-streams(9F).) qbufcall() schedules the specified function
50 to execute after entering the perimeters associated with the queue
51 passed in as the first parameter to qbufcall(). All outstanding time‐
52 outs and bufcalls must be cancelled (using, respectively, quntime‐
53 out(9F) and qunbufcall(9F)) before a driver close routine can block and
54 before the close routine calls qprocsoff(9F).
55
56
57 qprocson(9F) must be called before calling either qbufcall() or qtime‐
58 out(9F).
59
61 If successful, the qbufcall() function returns a qbufcall ID that can
62 be used in a call to qunbufcall(9F) to cancel the request. If the qbuf‐
63 call() scheduling fails, func is never called and 0 is returned.
64
66 The qbufcall() function can be called from user, interrupt, or kernel
67 context.
68
70 allocb(9F), mt-streams(9F), qprocson(9F), qtimeout(9F), qunbufcall(9F),
71 quntimeout(9F)
72
73
74 Writing Device Drivers
75
76
77 STREAMS Programming Guide
78
80 Even when func is called by qbufcall(), allocb(9F) can fail if another
81 module or driver had allocated the memory before func was able to call
82 allocb(9F).
83
84
85
86SunOS 5.11 16 Jan 2006 qbufcall(9F)