STREAMS-UX Programmer's Guide (February 2007)
Modules and Drivers
STREAMS Driver
Chapter 4
105
Service Procedure
Services procedures are optional for the drivers too and defined when the messages can get enqueued on to a
driver’s read-side queue.
The following example shows a read service procedure for a driver:
int
drv_rsrv(q)
queue_t *q;
{
mblk_t *mp;
while ((mp = getq(q)) != NULL) {
/* check for flow control */
if (!(mp->b_datap->db_type >= QPCTL) &&
!canputnext(q) {
putbq(q,mp);
return;
}
/* Process the message */
switch (mp->b_datap->db_type) {
case M_DATA:
...
...
}
} /* while */
}