STREAMS-UX Programmer's Guide (February 2007)

Multiplexing
Connecting and Disconnecting Multiplexor Configurations
Chapter 5
116
To Disconnect a Multiplexor Configuration
Disconnection of multiplexor configurations involves unlinking lower streams. The unlinking can be
accomplished by the following three methods:
•An I_UNLINK ioctl referencing a specific stream.
•An I_UNLINK ioctl indicating all lower streams.
•The last close() on the upper controlling stream.
An I_UNLINK ioctl performs the unlink operation as follows:
1. The controlling stream receives a muxid or MUXID_ALL value in the I_UNLINK ioctl. This specifies an
unlink operation on an individual link or an unlink operation on all the lower streams respectively.
2. The controlling stream remembers all the link operations processed through its stream head. It sends an
linkblk structure down to the multiplexing driver through an M_IOCTL message for each unlink
operation. If the user specified MUXID_ALL in the I_UNLINK ioctl, the multiplexor sees a series of
individual unlinks. If the user specified a muxid that is returned from the unlink operation, a single
unlink request with the muxid in the l_index is sent to the multiplexing driver in the M_IOCTL message.
3. The controlling stream will replace the lower stream head queue’s qinit structures with the original
stream head queue’s qinit structures.
NOTE The I_UNLINK ioctl performs the unlink operation as follows.
If no reference exists for a lower stream (i.e. the lower stream has been closed), a
subsequent unlink will automatically close the stream. Otherwise, the lower stream must
be closed after the unlink operation.
STREAMS will automatically dismantle all cascaded multiplexors if their controlling
stream is closed.
•An I_UNLINK will leave lower, cascaded multiplexing streams intact unless the file
descriptors of the cascaded multiplexing streams were previously closed.