STREAMS-UX Programmer's Guide (February 2007)
Multiplexing
Building and Dismantling Multiplexors
Chapter 5
113
To Dismantle a Multiplexor
The I_UNLINK ioctl call can be used to disconnect one or all the streams connected below a multiplexor:
ioctl(muxfd, I_UNLINK, muxid);
muxfd
Is the file descriptor associated with the controlling stream, which was used to create the
link(s). The muxid is associated with the stream linked below the multiplexor. If MUXID_ALL
is specified as the third argument, then all the streams that are connected below a
multiplexor are disconnected. The MUXID_ALL is only valid on the controlling stream that
was used to create the links.
The multiplexor configuration is automatically dismantled if the muxfd associated with the controlling
stream is closed or when the last process that references it exits. Use the persistent link mechanism if
multiplexor configurations need to be retained after the controlling stream is closed. The details of persistent
links are provided in the next section.
Routing Data through a Multiplexor
The criteria that is used by the multiplexors to route data between the linked streams are multiplexor
implementation dependent. For example, the IP multiplexor uses the IP address specified in the protocol
address to determine the subnetwork over which the data should be routed. Alternatively, the multiplexor
design may require the user application to prepend data containing the muxid (returned by I_LINK) in each
send request. The driver can then match the muxid in each message with the muxid of the corresponding
lower stream and route the data accordingly.