In the open routine of ptem(7M) a STREAMS message block is allocated for a zero-length message for delivering a hangup message; this allocation of a buffer is done before it is needed to ensure that a buffer is available. An M_SETOPTS message is sent upstream to set the read side Stream head queues, to assign high-water and low-water marks (1024 and 256 respectively), and to establish a controlling terminal.
The same default values as for the line discipline module are assigned to cflags, and INUSE to the state field.
These default values are currently being examined and may change in the future.
The open routine fails if:
No free entries are found when the ptem(7M) structure is searched.
sflag is not set to MODOPEN.
A zero-length message cannot be allocated (no buffer is available).
A stroptions(9S) structure cannot be allocated.
The close routine is called on the last close of the slave side Stream. Pointers to read and write queues are cleared and the buffer for the zero-length message is freed.