|
|
1.1 root 1: /* dlcread.c - dlcread */
2:
3: #include <conf.h>
4: #include <kernel.h>
5: #include <slu11.h>
6: #include <proc.h>
7: #include <sleep.h>
8: #include <dlc.h>
9:
10: /*------------------------------------------------------------------------
11: * dlcread -- read a block (frame) to user's buffer, unstuffing chars
12: *------------------------------------------------------------------------
13: */
14: dlcread(devptr, buf, maxchars)
15: struct devsw *devptr;
16: char *buf;
17: int maxchars;
18: {
19: char ps;
20: int nread;
21: struct dlblk *dptr;
22:
23: disable(ps);
24: if (maxchars<=0 || (dptr=devptr->dvioblk)->distate != DLIINIT) {
25: restore(ps);
26: return(SYSERR);
27: }
28: dptr->distate = DLIREADY;
29: dptr->dinext = dptr->distart = buf;
30: dptr->dimax = maxchars;
31: dptr->dicount = 0;
32: dptr->diesc = FALSE;
33: dptr->diproc = currpid;
34: suspend(currpid);
35: nread = dptr->dicount;
36: dptr->distate = DLIINIT;
37: restore(ps);
38: return(nread);
39: }
This archive runs on limited infrastructure. Preserving old code on modern bandwidth. Automated agents are requested to crawl responsibly.