The following example shows the code for the upper multiplexer write service procedure:
static int muxuwsrv(queue_t *q) { mblk_t *mp; struct mux *muxp; muxp = (struct mux *)q->q_ptr; if (!muxbot) { flushq(q, FLUSHALL); return (0); } if (muxerr) { flushq(q, FLUSHALL); return (0); } while (mp = getq(q)) { if (canputnext(muxbot)) putnext(muxbot, mp); else { putbq(q, mp); return(0); } } return (0); }
As long as there is a Stream still linked under the multiplexer and there are no errors, the service procedure will take a message off the queue and send it downstream, if flow control allows.