Initializing the Stream
This section describes the procedure for initializing the STREAMS.
At system initialization a user-written process, getstrm, is created for each tty port. The getstrm process opens a stream to its port and pushes the CHARPROC module onto the stream by use of a I_PUSH operation. Then, the process issues a getmsg system call to the stream and sleeps until a message reaches the stream head. The stream is now in its idle state.
The initial idle stream contains only one pushable module, CHARPROC. The device driver is a limited-function, raw tty driver connected to a limited-function communication port. The driver and port transparently transmit and receive one unbuffered character at a time.
Upon receipt of initial input from a tty port, the getstrm process establishes a connection with the terminal, analyzes the option requests, verifies them, and issues STREAMS subroutines to set the options. After setting up the options, the getstrm process creates a user application process. Later, when the user terminates that application, the getstrm process restores the stream to its idle state by use of subroutines.
The next step is to analyze in more detail how the stream sets up the communications options.