STREAMS-UX Programmer's Guide (February 2007)
Multiplexing
STREAMS Multiplexor
Chapter 5
129
*/
if (sflag != CLONEOPEN)
{
/* Non-clone open */
minor_dev = minor(*dev);
} else {
/* Clone open */
for(minor_dev=0; minor_dev < MUXCNT; minor_dev++)
if (mux_list[minor_dev].top_rq == NULL) break;
}
if (minor_dev >= MUXCNT) return ENOENT; /* Failure */
muxp = &mux_list[minor_dev];
muxp->top_rq = q;
/*
* Assign the private data structure to both the read and the write
* side q_ptr’s.
*/
q->q_ptr = WR(q)->q_ptr = muxp;
return 0 ; /* Success */
}
int
mux_close(q, cflag, credp)
queue_t *q;
int cflag;
cred_t *credp
{
((mux_data_t *)q->q_ptr)->top_rq = NULL;
/*
* Assign NULL to both the read and the write side q_ptr’s
*/
q->q_ptr = WR(q)->q_ptr = NULL;
return 0 ; /* Success */
}