STREAMS/UX for the HP 9000 Reference Manual
63
Differences Between STREAMS/UX and System V Release 4 STREAMS
STREAMS/UX Uniprocessor Synchronization
7 Drivers and modules should not call STREAMS/UX utilities from software
running on the interrupt control stack processing an spl6 or higher interrupt.
STREAMS/UX protects its internal data structures using spl5.
Driver and Module Synchronization
Drivers and modules must protect their private data structures against
interrupts. This can be done in four ways. One way would occur if software
that is running on the interrupt control stack (ICS) modifies driver and
module data structures. In this case, the driver and module service and put
routines must raise the spl level before accessing their data structures.
Drivers and modules can call the STREAMS/UX utility splstr to raise the
spl level to spl5. Interrupts are masked while the spl level is raised.
The second way to protect data structures against interrupts is for software
running on the ICS to send a message to a stream. If this is done, drivers and
modules do not need to raise the spl level to protect their data. The software
running on the ICS does a putq on the driver's read queue. The STREAMS
scheduler will run the service routine off the ICS. When ICS software calls
putq for a priority band, the driver open function must allocate the band by
calling strqget. This prevents putq from dynamically allocating memory for
the band on the ICS.
ICS software can call putnext or put instead of putq to send a message to a
stream. If one of these utilities is called, STREAMS/UX will attempt to run
the put routine on the ICS. Drivers and modules will need to use spl calls to
protect data structures that they share with other drivers and modules, with
other instances of the same driver or module, or with non-STREAMS/UX
software.
The third way to protect data structures against interrupts is for interrupt
software to call the qenable utility to schedule a service routine. The
STREAMS/UX scheduler will run the service routine off the ICS.
The fourth method for protecting data structures against interrupts is to call
the new streams_put utility. The code running on the ICS passes
streams_put a function and a queue. STREAMS/UX runs the function as if
it were the queue's put routine. The function can access the same data
structures as the queue's put routine. See “HP-UX Modifications to
STREAMS/UX Utilities” in this chapter for more information about
streams_put.