STREAMS-UX Programmer's Guide (February 2007)

Overview
STREAMS Components
Chapter 1
13
Figure 1-2 Stream without a STREAMS Module
Stream Head
The stream head is the interface between the user process and the STREAMS driver or module. It consists of
a set of data structures and associated kernel routines. The kernel routines operate on the data structures
and interface with the next stream component in the sequence. The stream head receives data from user
processes, packs it into STREAMS messages, and sends these messages downstream to the module or driver.
The stream head also receives data back from the module or driver, and makes the data available for the user
process.
STREAMS Module
Modules are optional components of a stream. Modules process the messages in a stream before sending them
to the driver. The functionality provided by a module is based on application requirements. Message
encryption, decryption, and string manipulation are some of the examples of module functionality. A user
process pushes a module on to a stream via the ioctl() system call. The new module becomes the first
component below the stream head. When multiple modules are pushed on to a stream, the last module to be
pushed is located just below the stream head. Figure 1-1, “Stream with a STREAMS Module,” shows a block
diagram of a stream with one module. Figure 1-2, “Stream without a STREAMS Module,” shows a block
diagram of a stream without modules.
STREAMS Driver or Pseudo-Driver
A STREAMS driver is located below the stream head and modules and is the stream end. The driver can act
on a real external I/O device. Or, it can be a pseudo-driver.
Stream Head
Driver
User Space
Kernel Space
UpstreamDownstream
User Application