STREAMS/UX for the HP 9000 Reference Manual

50
Differences Between STREAMS/UX and System V Release 4 STREAMS
HP-UX Modifications to STREAMS/UX Utilities
weldq
Weldq connects two drivers' queues to form a pipe by setting the q_next
pointer:
int weldq (d1_wq, d2_rq, d2_wq, d1_rq, func, arg, protect_q);
queue_t * d1_wq;
queue_t * d2_rq;
queue_t * d2_wq;
queue_t * d1_rq;
weld_fcn_t func;
weld_arg_t arg;
queue_t * protect_q;
d1_wq and d1_rq are one of the drivers' write and read queues. d2_wq and
d2_rq are the second driver's queues. weldq will set d1_wq->q_next to be
d2_rq and d2_wq->q_next to d1_rq. Also, weldq updates queue fields used
for flow control that are not visible to the STREAMS/UX programmer, and
therefore cannot be updated by the STREAMS/UX programmer.
weldq returns to the caller before connecting the drivers. weldq requests the
STREAMS/UX weld daemon to update the queues.
The weld daemon will call func with arg as an argument after it finishes the
request. protect_q specifies which queue the callback function can access
safely. See “STREAMS/UX Uniprocessor Synchronization” in this chapter
and “Writing MP Scalable Modules and Drivers” in Chapter 4 for a more
detailed discussion of protect_q.
If your driver does not need to be notified when the daemon finishes the
weld request, pass weldq zero for the func, arg, and protect_q parameters.
On successful completion, weldq returns 0. However, if weldq fails, an
errno indicating the type of error that has occurred is returned. The errno
will contain one of the following three values:
ENXIO means that the weld daemon is not running.
EINVAL means that invalid queue arguments exist.
EAGAIN means that no memory is available.
Note that if one end of a pipe-like stream created by weldq is closed,
STREAMS/UX will automatically unweld the two drivers. unweldq does
not need to be called.