|
|
1.1 ! root 1: /* getitem.c - getfirst, getlast */ ! 2: ! 3: #include <conf.h> ! 4: #include <kernel.h> ! 5: #include <q.h> ! 6: ! 7: /*------------------------------------------------------------------------ ! 8: * getfirst -- remove and return the first process on a list ! 9: *------------------------------------------------------------------------ ! 10: */ ! 11: int getfirst(head) ! 12: int head; /* q index of head of list */ ! 13: { ! 14: int proc; /* first process on the list */ ! 15: ! 16: if ((proc=q[head].qnext) < NPROC) ! 17: return( dequeue(proc) ); ! 18: else ! 19: return(EMPTY); ! 20: } ! 21: ! 22: ! 23: ! 24: /*------------------------------------------------------------------------ ! 25: * getlast -- remove and return the last process from a list ! 26: *------------------------------------------------------------------------ ! 27: */ ! 28: int getlast(tail) ! 29: int tail; /* q index of tail of list */ ! 30: { ! 31: int proc; /* last process on the list */ ! 32: ! 33: if ((proc=q[tail].qprev) < NPROC) ! 34: return( dequeue(proc) ); ! 35: else ! 36: return(EMPTY); ! 37: }
This archive runs on limited infrastructure. Preserving old code on modern bandwidth. Automated agents are requested to crawl responsibly.