Annotation of xinu/sys/unsleep.c, revision 1.1.1.1

1.1       root        1: /* unsleep.c - unsleep */
                      2: 
                      3: #include <conf.h>
                      4: #include <kernel.h>
                      5: #include <proc.h>
                      6: #include <q.h>
                      7: #include <sleep.h>
                      8: 
                      9: /*------------------------------------------------------------------------
                     10:  * unsleep  --  remove  process from the sleep queue prematurely
                     11:  *------------------------------------------------------------------------
                     12:  */
                     13: SYSCALL        unsleep(pid)
                     14:        int     pid;
                     15: {
                     16:        struct  pentry  *pptr;
                     17:        struct  qent    *qptr;
                     18:        int     remain;
                     19:        int     next;
                     20:        PStype  ps;
                     21: 
                     22:         disable(ps);
                     23:        if (isbadpid(pid) ||
                     24:            ( (pptr = &proctab[pid])->pstate != PRSLEEP &&
                     25:             pptr->pstate != PRTRECV) ) {
                     26:                restore(ps);
                     27:                return(SYSERR);
                     28:        }
                     29:        qptr = &q[pid];
                     30:        remain = qptr->qkey;
                     31:        if ( (next=qptr->qnext) < NPROC)
                     32:                q[next].qkey += remain;
                     33:        dequeue(pid);
                     34:        if ( (next=q[clockq].qnext) < NPROC)
                     35:                sltop = (short *) & q[next].qkey;
                     36:        else
                     37:                slnempty = FALSE;
                     38:         restore(ps);
                     39:        return(OK);
                     40: }

unix.superglobalmegacorp.com

This archive runs on limited infrastructure. Preserving old code on modern bandwidth. Automated agents are requested to crawl responsibly.