STREAMS-UX Programmer's Guide (February 2007)

Modules and Drivers
STREAMS Driver
Chapter 4
106
Driver Specific Design Guidelines
In addition to the guidelines listed in the “Design Guidelines” section, the driver developers should follow
these guidelines:
A driver must be defined and configured in a kernel before it can be opened.
Drivers managing a hardware device must have an interrupt service procedure.
Messages that are not understood by the driver should be freed.
The M_IOCTL messages must be processed and acknowledged by the driver, or the stream head will block
for an M_IOCACK or M_IOCNAK until the timeout (which could potentially be infinite) expires.
If a driver does not understand the IOCTL, it must send an M_IOCNAK upstream.
Drivers are responsible for processing all M_FLUSH messages and whenever appropriate turn M_FLUSH
messages around, i.e., sending the M_FLUSH message upstream.
Driver developers should be very careful with the M_ERROR messages, as an error message M_ERROR
received at the stream head could lock up the stream.
If a driver wants to allocate a controlling terminal, it should send a M_SETOPTS message with the
SO_ISTTY flag set upstream.