Next | Prev | Up | Top | Contents | Index
STREAMS Example
#include "sys/strmp.h"
static void interrup_handler;
/* Actual interrupt routine that is called on an interrupt */
driverintr(unit)
int unit:
{
/* Check to see if interrupt is valid */
if (driver[unit]->intrmask !=0 {
/* Call the interrupt handler that interacts
* with STREAMS */
streams_interrupt(interrupt_handler,unit);
}
else {
/* Stray interrupt! */
driver[unit]->stray++;
}
return;
}
/* Second-level interrupt handler that interacts with
* STREAMS. This guarantees mutually exclusive access
* to STREAMS */
static void
interrupt_handler(unit)
int unit;
{
register mblk_t *bp;
if ((bp = allocb(128,BPRI_HI)) ==0) {
/* Unable to allocate STREAMS block */
driver[unit]->allocb_fail++;
return
}
/* Copy data into message block */
bcopy(driver[unit]->data,bp->wptr,128);
/* Put onto our read queue for additional processing */
putq(driver[unit]->rq,bp);
return;
}
Next | Prev | Up | Top | Contents | Index