1WR(9F) Kernel Functions for Drivers WR(9F)
2
3
4
6 WR, wr - get pointer to the write queue for this module or driver
7
9 #include <sys/stream.h>
10 #include <sys/ddi.h>
11
12
13
14 queue_t *WR(queue_t *q);
15
16
18 Architecture independent level 1 (DDI/DKI).
19
21 q Pointer to the read queue whose write queue is to be returned.
22
23
25 The WR() function accepts a read queue pointer as an argument and
26 returns a pointer to the write queue of the same module.
27
28
29 CAUTION: Make sure the argument to this function is a pointer to a read
30 queue. WR() will not check for queue type, and a system panic could
31 result if the pointer is not to a read queue.
32
34 The pointer to the write queue.
35
37 The WR() function can be called from user, interrupt, or kernel con‐
38 text.
39
41 Example 1 Using WR()
42
43
44 In a STREAMS close(9E) routine, the driver or module is passed a
45 pointer to the read queue. These usually are set to the address of the
46 module-specific data structure for the minor device.
47
48
49
50 1 xxxclose(q, flag)
51 2 queue_t *q;
52 3 int flag;
53 4 {
54 5 q->q_ptr = NULL;
55 6 WR(q)->q_ptr = NULL;
56 . . .
57 7 }
58
59
61 close(9E), OTHERQ(9F), RD(9F)
62
63
64 Writing Device Drivers
65
66
67 STREAMS Programming Guide
68
69
70
71SunOS 5.11 16 Jan 2006 WR(9F)