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
265
streams_put utility
STREAMS/UX provides a new utility streams_put(), which allows non-STREAMS software to safely call
STREAMS/UX utilities. timeout and bufcall user functions and other non-STREAMS code cannot call
several of the STREAMS utilities or share data with modules and drivers.
Non-STREAMS code can call streams_put(), passing it a function and a queue. STREAMS/UX runs the
function as if it were the queue’s put procedure. The function can safely manipulate the queue and access the
same data structures as the queue’s put procedure.
typedef void (*streams_put_t)(void *, MBPKP);
void streams_put(streams_put_t func, queue_t *q, mblk_t *mp, void *private);
STREAMS will run func as if it were q’s put procedure. STREAMS passes private and mp to func. The
non-STREAMS code can pass any value in the private parameter. The code must pass a valid message block
pointer in mp.
SV_WAIT
STREAMS/UX implements a subset of the SVR4 MP synchronization variable utilities using sleep and
wakeup. The STREAMS/UX SV_WAIT differs from the SVR4 MP utility in the following ways.
When the SVR4 MP SV_WAIT returns, the lkp spinlock is not held and the priority level is set to plbase
(SPLNOPREEMPT on HP-UX). On a multiprocessor system, the HP-UX SV_WAIT lowers the priority level to
the value before the caller acquired the lkp spinlock, which may not be SPLNOPREEMPT. If the caller
acquired the lock while holding other spinlocks, the priority level is lowered to the value before the first of
these nested spinlock calls.
The SVR4 MP SV_WAIT has a priority argument that specifies the priority the caller would like to run at
after waking. Since the HP-UX SV_WAIT is implemented by calling sleep, the HP-UX priorities are
different than the SVR4 MP ones. On HP-UX, the priority passed into SV_WAIT is subtracted from
PZERO-1. The pridisk, prinet, pritty, pritape, prihi, primed, and prilo are defined to be 0 and do
not affect the caller’s priority. To change the process’s priority, study the priorities in
/usr/include/sys/param.h and pass the needed offset to PZERO-1 in the priority parameter.
SV_WAIT_SIG
HP implements a subset of the SVR4 MP synchronization variable utilities using sleep and wakeup. The
STREAMS/UX SV_WAIT_SIG differs from the SVR4 MP utility in the following ways.
When the SVR4 MP SV_WAIT_SIG returns, the lkp spinlock is not held, and the priority level is set to
plbase (SPLNOPREEMPT on HP-UX). On a multiprocessor system, the HP-UX SV_WAIT_SIG lowers the
priority level to the value before the caller acquired the lkp spinlock, which may not be SPLNOPREEMPT.
If the caller acquired the lock while holding other spinlocks, the priority level is lowered to the value
before the first of these nested spinlock calls.
Also, the SVR4 MP SV_WAIT_SIG has a priority argument that specifies the priority the caller would like
to run at after waking. Since the HP-UX SV_WAIT_SIG is implemented by calling sleep, the HP-UX
priorities are different than the SVR4 MP ones.
On HP-UX, the priority passed into SV_WAIT_SIG is added to PZERO+1|PCATCH. pridisk, prinet, pritty,
pritape, prihi, primed and prilo are defined to be 0 and do not affect the caller’s priority. To change the
process’s priority, study the priorities in /usr/include/sys/param.h and pass the needed offset to
PZERO+1|PCATCH in the priority parameter.