STREAMS-UX Programmer's Guide (February 2007)

Multiplexing
STREAMS Multiplexor
Chapter 5
131
case I_LINK:
case I_PLINK:
if (muxbot_wq != NULL)
/* lower stream is already linked */
mp->b_datap->db_type = M_IOCNAK;
else {
/* Obtain the linkblk from the message
* and set up the link
*/
linkp = (struct linkblk *)mp->b_cont->b_rptr;
muxbot_wq = linkp->l_qbot;
muxerr = 0;
iocp->ioc_count = 0;
mp->b_datap->db_type = M_IOCACK;
}
qreply(q,mp);
break;
case I_UNLINK:
case I_PUNLINK:
muxbot_wq = NULL;
mp->b_datap->db_type = M_IOCACK;
iocp->ioc_count = 0;
qreply(q, mp);
break;
...
/* other ioctl commands recognized by the driver */
case D_IOCTL1:
/* process and reply back with a positive
* or negative acknowledgment
*/
...
if (success) {
...
mp->b_datap->db_type = M_IOCACK;
} else {
...
mp->b_datap->db_type = M_IOCNAK;
}
qreply(q, mp);
break;