[ Previous | Next | Table of Contents | Index | Library Home | Legal | Search ]

Communications Programming Concepts


Using STREAMS

Applications programmers can take advantage of the STREAMS facilities by using a set of system calls, subroutines, utilities, and operations. The subroutine interface is upward-compatible with the existing character I/O facilities.

Subroutines

The open, close, read, and write subroutines support the basic set of operations on streams. In addition, new operations support advanced STREAMS facilities.

The poll subroutine enables an application program to poll multiple streams for various events. When used with the I_SETSIG operation, the poll subroutine allows an application to process I/O in an asynchronous manner.

The following is a set of STREAMS-related subroutines:

open Opens a stream to the specified driver.
close Closes a stream.
read Reads data from a stream. Data is read in the same manner as character files and devices.
write Writes data to a stream. Data is written in the same manner as character files and devices.
poll Notifies the application program when selected events occur on a stream.

System Calls

The putmsg and getmsg system calls enable application programs to interact with STREAMS modules and drivers through a service interface.

getmsg Receives the message at the stream head.
getpmsg Receives the priority message at the stream head.
putmsg Sends a message downstream.
putpmsg Sends a priority message downstream.

streamio Operations

After a stream has been opened, ioctl operations allow a user process to insert and delete (push and pop) modules. That process can then communicate with and control the operation of the stream head, modules, and drivers, and can send and receive messages containing data and control information.

ioctl Controls a stream by enabling application programs to perform functions specific to a particular device. A set of generic STREAMS ioctl operations (referred to as streamio operations) support a variety of functions for accessing and controlling streams.


[ Previous | Next | Table of Contents | Index | Library Home | Legal | Search ]