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

1.1       root        1: /* insertd.c - insertd */
                      2: 
                      3: #include <conf.h>
                      4: #include <kernel.h>
                      5: #include <q.h>
                      6: 
                      7: /*------------------------------------------------------------------------
                      8:  *  insertd  --  insert process pid in delta list "head", given its key
                      9:  *------------------------------------------------------------------------
                     10:  */
                     11: insertd(pid, head, key)
                     12:        int     pid;
                     13:        int     head;
                     14:        int     key;
                     15: {
                     16: 
                     17:        int     next;                   /* runs through list            */
                     18:        int     prev;                   /* follows next through list    */
                     19: 
                     20:        if (key < 0 || key > MAXSHORT)
                     21:                return (SYSERR);
                     22: 
                     23:        for(prev=head,next=q[head].qnext ;
                     24:            q[next].qkey < key ; prev=next,next=q[next].qnext)
                     25:                key -= q[next].qkey;
                     26:        q[pid].qnext = next;
                     27:        q[pid].qprev = prev;
                     28:        q[pid].qkey  = key;
                     29:        q[prev].qnext = pid;
                     30:        q[next].qprev = pid;
                     31:        if (next < NPROC)
                     32:                q[next].qkey -= key;
                     33:        return(OK);
                     34: }

unix.superglobalmegacorp.com

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