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

1.1       root        1: /* queue.c - dequeue, enqueue */
                      2: 
                      3: #include <conf.h>
                      4: #include <kernel.h>
                      5: #include <q.h>
                      6: 
                      7: /*------------------------------------------------------------------------
                      8:  * enqueue  -- insert an item at the tail of a list
                      9:  *------------------------------------------------------------------------
                     10:  */
                     11: int    enqueue(item, tail)
                     12:        int     item;                   /* item to enqueue on a list    */
                     13:        int     tail;                   /* index in q of list tail      */
                     14: {
                     15:        struct  qent    *tptr;          /* points to tail entry         */
                     16:        struct  qent    *mptr;          /* points to item entry         */
                     17: 
                     18:        tptr = &q[tail];
                     19:        mptr = &q[item];
                     20:        mptr->qnext = tail;
                     21:        mptr->qprev = tptr->qprev;
                     22:        q[tptr->qprev].qnext = item;
                     23:        tptr->qprev = item;
                     24:        return(item);
                     25: }
                     26: 
                     27: 
                     28: /*------------------------------------------------------------------------
                     29:  *  dequeue  --  remove an item from a list and return it
                     30:  *------------------------------------------------------------------------
                     31:  */
                     32: int    dequeue(item)
                     33:        int     item;
                     34: {
                     35:        struct  qent    *mptr;          /* pointer to q entry for item  */
                     36: 
                     37:        mptr = &q[item];
                     38:        q[mptr->qprev].qnext = mptr->qnext;
                     39:        q[mptr->qnext].qprev = mptr->qprev;
                     40:        return(item);
                     41: }

unix.superglobalmegacorp.com

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