STREAMS Programming Guide


The STREAMS Programming Guide describes how to use STREAMS in designing and implementing applications and STREAMS modules and drivers, for architectures that conform to the SolarisTM 7 DDI/DDK.

Who Should Read This Book

The manual is a guide for application, driver, and module developers. The reader must know C programming in a UNIXTM environment, and be familiar with the system interfaces. Driver and module developers should also be familiar with the book Writing Device Drivers.

How This Book Is Organized

This guide is divided into three parts. Part IPart 1 describes how to use STREAMS facilities in applications. Part IIPart 2 describes how to design STREAMS modules and STREAMS drivers. Part IIIPart 3 contains advanced topics. Every developer should read Chapter 1.

Part I

Part II

Part III


Code Examples

All code examples used in this book conform to ANSI C specifications.

Conventions Used

The word "STREAMS" refers to the mechanism and "Stream" refers to an explicit path between a user application and a driver.

Examples highlight common capabilities of STREAMS, and reference fictional drivers and modules. Where possible, examples are executable code.

The following table describes the typographic conventions used in this book.

Table P-1 Typographic Conventions

Typeface or Symbol 




The names of commands, files, and directories; on-screen computer output 

Edit your .login file.

Use ls -a to list all files.

machine_name% You have mail.



What you type, contrasted with on-screen computer output 

machine_name% su



Interface or command-line variable: provide a real path or value 

To delete a file, type rm filename.


Book titles, new words or terms, or words to be emphasized 

Read Chapter 6 in User's Guide. These are called class options.

You must be root to do this.

Caution - Caution -

The warning sign shows possible damage to data, system, application, or person.

Caution - Caution -

The caution sign shows possible harm or damage to a system, an application, a process, or a piece of hardware.

Note -

Notes are used to emphasize points of interest, to present parenthetical information, and to cite references to other documents and commands.

Related Books

You can obtain more information on STREAMS system calls and utilities from the on-line manual pages. For more information on driver-related issues, including autoconfiguration, see Writing Device Drivers.

You can also find STREAMS described to some extent in the System V Interface Definition, and in the following publications:

Goodheart, Berny and Cox, James. The Magic Garden Explained. Australia, & Englewood Cliffs, New Jersey: Prentice Hall, 1994.

Rago, Stephen A. UNIX System V Network Programming. Reading, Massachusetts: Addison-Wesley, 1993.

Ordering Sun Documents

The SunDocsSM program provides more than 250 manuals from Sun Microsystems, Inc. If you live in the United States, Canada, Europe, or Japan, you can purchase documentation sets or individual manuals using this program.