STREAMS-UX Programmer's Guide (February 2007)
Differences Between STREAMS/UX and System V Release 4 STREAMS
HP-UX Modifications to STREAMS/UX Utilities
Appendix E
266
• The last difference is that the SVR4 MP SV_WAIT_SIG returns if the process is first stopped by a job
control signal and then continued. The HP-UX SV_WAIT_SIG continues to sleep until it receives a signal
which does not stop the process or an SV_BROADCAST wakes up the process.
TRYLOCK
The STREAMS/UX TRYLOCK calls the native HP-UX cspinlock primitive. TRYLOCK has an interrupt
priority level parameter, which is used to raise the priority level and block interrupts which acquire the
spinlock. The SVR4.2 Driver manual says that implementations which do not require the interrupt level to be
raised, can ignore this parameter. STREAMS/UX ignores the parameter on multiprocessor systems since the
HP-UX cspinlock primitive always raises the interrupt level to spl6 while a spinlock is held. For better
performance on uniprocessor systems, the STREAMS/UX TRYLOCK raises the priority level to the
parameter value instead of acquiring a spinlock.
UNLOCK
The STREAMS/UX UNLOCK calls the native HP-UX spinunlock primitive. UNLOCK has an interrupt
priority level parameter, which is used to lower the priority level. HP-UX will ignore this parameter on
multiprocessor systems. If the caller is not holding any other spinlocks, the STREAMS/UX UNLOCK lowers
the priority level to the value before the caller acquired the spinlock. On uniprocessor systems, the
STREAMS/UX UNLOCK lowers the priority level to the parameter value instead of releasing a spinlock.
weldq and unweldq
STREAMS/UX provides the additional utilities weldq and unweldq to allow the user to build a pipe-like
stream. These utilities are provided because the programmer is not allowed to modify q_next pointers
directly
weldq
The weldq connects two drivers’ queues to form a pipe by setting the q_next pointer:
int weldq (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, d1_rq One of the drivers’ write and read queues.
d2_wq, d2_rq The second driver’s queues.
func Callback function to be executed by the weld daemon.
arg, protect_q Parameters passed to the previous function.
The weldq will set d1_wq->q_next to be d2_rq and d2_wq->q_next to d1_rq. Also, weldq updates internal
queue fields used for flow control that are not visible to the STREAMS programmer.
The weldq returns to the caller before connecting the drivers. The weldq requests the STREAMS weld
daemon to update the queues.