STREAMS-UX Programmer's Guide (February 2007)
Multiplexing
STREAMS Multiplexor
Chapter 5
130
Put Procedure
In a multiplexing configuration:
• The upper write put and the lower read put procedures are mandatory.
• The upper read put and the lower write put procedures can be skipped over and the message put to the
next queue if they are not mandatory.
In this example, the upper read side put procedure is not used. The lower stream read queue procedures
transfer the messages directly to the read queue upstream from the multiplexor. There is no lower write put
procedure either. This is because the upper write procedures directly feed the lower write queue downstream
from the multiplexor.
Upper Write Put Procedure
Downstream data written to an upper stream in a multiplexing configuration is queued on the corresponding
upper write queue if the lower stream is flow controlled.
The upper write put procedure does the following:
• Trap all ioctls and in particular handle the I_LINK/I_PLINK and I_UNLINK/I_PUNLINK ioctls.
•Handle M_FLUSH message like a driver.
• Discard any unrecognized messages it receives.
An example of a upper write put procedure is shown below:
int
mux_uwput(q, mp)
queue_t *q;
mblk_t *mp;
{
...
if ((mp->b_datap->db_type >= QPCTL) &&
(mp->b_datap->db_type != M_FLUSH)) {
/* Process the high priority message */
return;
}
switch (mp->b_datap->db_type) {
case M_DATA:
case M_PROTO:
/* Let the service procedure do the processing */
putq(q,mp);
break;
case M_IOCTL:
struct iocblk * iocp = (struct iocblk *)mp->b_rptr;
switch (iocp->ioc_cmd) {
/* plumb/unplumb ioctls */