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.

Note –

This Solaris release supports systems that use the SPARC® and x86 families of processor architectures: UltraSPARC®, SPARC64, AMD64, Pentium, and Xeon EM64T. The supported systems appear in the Solaris 10 Hardware Compatibility List at This document cites any implementation differences between the platform types.

In this document the term “x86” refers to 64-bit and 32-bit systems manufactured using processors compatible with the AMD64 or Intel Xeon/Pentium product families. For supported systems, see the Solaris 10 Hardware Compatibility List.

Who Should Use This Book

This manual is a guide for application, driver, and module developers. The reader must know C programming in a UNIX® 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 1, Application Programming Interface, describes how to use STREAMS facilities in applications. Part 2, Kernel Interface, describes how to design STREAMS modules and STREAMS drivers. Part 3, Advanced Topics, contains advanced topics. Every developer should read Chapter 1.

Part 1, Application Programming Interface

Part 2, Kernel Interface

Part 3, Advanced Topics

Part 4, Appendixes

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.

Accessing Sun Documentation Online

The docs.sun.comSM Web site enables you to access Sun technical documentation online. You can browse the archive or search for a specific book title or subject. The URL is

Typographic Conventions

The following table describes the typographic changes 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



Command-line placeholder: replace with a real name 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.

Shell Prompts in Command Examples

The following table shows the default system prompt and superuser prompt for the C shell, Bourne shell, and Korn shell.

Table P–2 Shell Prompts



C shell prompt 


C shell superuser prompt 


Bourne shell and Korn shell prompt 


Bourne shell and Korn shell superuser prompt