WR(D3DK) —
.IX \f4WR\fP(D3DK)
NAME
WR − get a pointer to the write queue
SYNOPSIS
#include <sys/stream.h>
#include <sys/ddi.h>
queue_t ∗WR(queue_t ∗q);
ARGUMENTS
qPointer to the queue whose write queue is to be returned.
DESCRIPTION
The WR function accepts a queue pointer as an argument and returns a pointer to the write queue of the same module.
RETURN VALUE
The pointer to the write queue.
LEVEL
Base or Interrupt.
NOTES
Does not sleep.
Driver-defined basic locks, read/write locks, and sleep locks may be held across calls to this function.
SEE ALSO
OTHERQ(D3DK), RD(D3DK)
EXAMPLE
.IX \f4WR\fP(D3DK), example
In a STREAMS open(D2DK) routine, the driver or module is passed a pointer to the read queue. The driver or module can store a pointer to a private data structure in the q_ptr field of both the read and write queues if it needs to identify the data structures from its put(D2DK) or srv(D2DK) routines.
1 extern struct xxx_dev[];
...
2 xxxopen(queue_t ∗q, dev_t ∗devp, int flag, int sflag, cred_t ∗crp)
3 {
...
3q->q_ptr = (caddr_t)&xxx_dev[getminor(∗devp)];
4WR(q)->q_ptr = (caddr_t)&xxx_dev[getminor(∗devp)];
...
5 }
REPLACE WITH BLANK PAGE
DDI/DKI — STREAMS