STREAMS/UX for the HP 9000 Reference Manual

60
Differences Between STREAMS/UX and System V Release 4 STREAMS
STREAMS/UX Data Structure Restrictions
STREAMS/UX Data Structure Restrictions
STREAMS/UX has the same restrictions as those described in the Kernel
Data Structure chapter of the SVR4.2 Driver manual. Also, STREAMS/UX
limits which user written functions can access the queue structure directly.
A queue's open, close, put, or service routine can manipulate the queue
structure as specified by SVR4.2. On a uniprocessor system, a queue's entry
points can access the other queue in the queue pair in the same way that they
can access their own queue. On a multiprocessor system, a queue's entry
points can manipulate queues belonging to entities with which they can
share data. They can manipulate the queues in the same way that they can
manipulate their own queue. See “Writing MP Scalable Modules and
Drivers” in Chapter 4 for more information about sharing data on
multiprocessor systems.
It is difficult to program other functions (besides those described above) to
access the queue structure directly, especially on multiprocessor systems. If
a queue's entry points access queues other than those described above, or if
non-STREAMS/UX software processes data in a STREAMS/UX queue, try
to use the streams_put utility to manipulate the queues safely. streams_put
is described in the “HP-UX Modifications to STREAMS/UX Utilities”
section of this chapter. If you cannot use streams_put, the code that accesses
a STREAMS/UX queue must, at a minimum, follow these additional rules.
The software must ensure that it is accessing an allocated, opened queue.
Also, it cannot dereference the q_first, q_last, or q_next pointers. In other
words, it cannot read or write data pointed at by the pointers. For example,
the function can check if q_first is 0, but it cannot read the q_first-b_next
field. Lastly, you must implement any additional synchronization required
for your modules and drivers to work correctly. You may need to
synchronize the function accessing the STREAMS/UX queue with the
queue's entry points. This is because the function and the entry points may
access the queue in parallel on a multiprocessor system and may interrupt
each other while accessing the queue on a uniprocessor system.