STREAMS-UX Programmer's Guide (February 2007)
STREAMS Mechanism and System Calls
Creating a Stream
Chapter 2
20
Figure 2-1 A STREAMS-Based Pipe
Each end of the pipe maintains the status of the other end through internal data structures. Subsequent read,
write, and close operations are aware of whether the other end of the pipe is open or closed.
STREAMS modules can be added to a STREAMS-based pipe with ioctl (2) I_PUSH from either end of the pipe.
However, if a module is pushed onto one end of the pipe, that module can not be popped out from the other
end.
STREAMS-based pipes are not attached to STREAMS-based character devices.
NOTE The standard (non-STREAMS-based) pipe is still the default on HP-UX. In order to change the
default pipe to a STREAMS-based pipe, set the kernel tunable parameter streampipes to 1.
Use kctune or SAM (STREAMS/UX installation will not automatically set this value). The
streampipes is a static tunable, i.e., any modification to it will take effect after the next reboot.
Refer to Appendix H, “STREAMS Kernel Tunable Parameters,” on page 297 for more details on
streampipes.
Synopsis
int pipe (int fd[2]);
Arguments
The pipe(2) system call takes an array of two integers as input and returns two integer file descriptors,
fd[0] and fd[1] into that integer array. These represent each end of the pipe.
Return Value
The pipe(2) system call returns a zero upon successful completion and -1 in case of failure. The
corresponding error is available in errno, as with all standard UNIX file system I/O.
User
Process
STREAM HEAD STREAM HEADModule Module
User Space
Kernel Space
STREAMS-based Pipe
User
Process
User
Process
STREAM HEAD STREAM HEADModule Module
User Space
Kernel Space
STREAMS-based Pipe
User
Process