STREAMS-UX Programmer's Guide (February 2007)
Multiplexing
STREAMS Multiplexor
Chapter 5
135
Service Procedure
In a multiplexing configuration, the lower write side and the upper read side service procedures are required
to handle the flow control in the lower and the upper streams respectively. The upper write side and the lower
read side service procedures are optional.
Upper Write Service Procedure
If there is a stream linked underneath the multiplexor, and there are no errors, mux_uwsrv() will take a
message off the queue, process it, and send it downstream, if the lower stream is not flow controlled.
int
mux_uwsrv(q)
queue_t * q;
{
...
if (muxerr || (muxbot_wq == NULL)) {
/* flush all the data on this queue */
...
return;
}
while(mp = getq(q)) {
if (canputnext(muxbot_wq)) {
/* Process data and send it downstream */
...
putnext(muxbot_wq,mp);
} else {
putbq(q,mp);
return;
}
}
return;
}