|
|
1.1 ! root 1: /* getbuf.c - getbuf */ ! 2: ! 3: #include <conf.h> ! 4: #include <kernel.h> ! 5: #include <mark.h> ! 6: #include <bufpool.h> ! 7: ! 8: /*------------------------------------------------------------------------ ! 9: * getbuf -- get a buffer from a preestablished buffer pool ! 10: *------------------------------------------------------------------------ ! 11: */ ! 12: SYSCALL *getbuf(poolid) ! 13: int poolid; ! 14: { ! 15: PStype ps; ! 16: int *buf; ! 17: ! 18: #ifdef MEMMARK ! 19: if ( unmarked(bpmark) ) ! 20: return((int *)SYSERR); ! 21: #endif ! 22: if (poolid<0 || poolid>=nbpools) ! 23: return((int *)SYSERR); ! 24: wait(bptab[poolid].bpsem); ! 25: disable(ps); ! 26: buf = (int *)bptab[poolid].bpnext; ! 27: bptab[poolid].bpnext = (char *)*buf; ! 28: restore(ps); ! 29: *buf++ = poolid; ! 30: return(buf); ! 31: }
This archive runs on limited infrastructure. Preserving old code on modern bandwidth. Automated agents are requested to crawl responsibly.