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

1.1       root        1: /* qdump.c - qdump, qdumph, qdumpa */
                      2: 
                      3: #include <conf.h>
                      4: #include <kernel.h>
                      5: #include <proc.h>
                      6: #include <q.h>
                      7: 
                      8: #define        isbadq(i)       ( (i)<0 || (i)>=NQENT )
                      9: 
                     10: /*------------------------------------------------------------------------
                     11:  *  qdump  --  dump the contents of the q structure for debugging
                     12:  *------------------------------------------------------------------------
                     13:  */
                     14: qdump()
                     15: {
                     16:        qxdump(0);
                     17: }
                     18: 
                     19: /*------------------------------------------------------------------------
                     20:  *  qdumph  --  dump the contents of the q structure
                     21:  *------------------------------------------------------------------------
                     22:  */
                     23: qdumph()
                     24: {
                     25:        qxdump(0);
                     26: }
                     27: 
                     28: /*------------------------------------------------------------------------
                     29:  *  qdumpa  --  dump the contents of the q structure printing all info
                     30:  *------------------------------------------------------------------------
                     31:  */
                     32: qdumpa()
                     33: {
                     34:        qxdump(1);
                     35: }
                     36: 
                     37: static qxdump(all)
                     38: int    all;
                     39: {
                     40:        struct  qent *qp;
                     41:        int     i;
                     42:        struct  pentry *pptr;
                     43:        int     pr;
                     44: 
                     45:        for (i=0 ; i<NQENT ; i++) {
                     46:            if ( (pr=all) == 0) {
                     47:                qp = &q[i];
                     48:                if (i < NPROC) {
                     49:                        pptr = &proctab[i];
                     50:                        if (pptr->pstate!=PRFREE)
                     51:                                pr = 1;
                     52:                } else { /* normal queue - could be head or tail */
                     53:                        if ( (qp->qnext<NPROC && qp->qnext>=0)
                     54:                           ||(qp->qprev<NPROC && qp->qprev>=0) )
                     55:                                pr = 1;
                     56:                        else if (qp->qkey == MAXSHORT) {
                     57:                                if (qp->qnext != EMPTY
                     58:                                    || isbadq(qp->qprev)
                     59:                                    || q[qp->qprev].qkey != MINSHORT
                     60:                                    || q[qp->qprev].qnext != i)
                     61:                                        pr = 1;
                     62:                        } else if (qp->qkey == MINSHORT) {
                     63:                                if (qp->qprev != EMPTY
                     64:                                    || isbadq(qp->qnext)
                     65:                                    || q[qp->qnext].qkey != MAXSHORT
                     66:                                    || q[qp->qnext].qprev != i)
                     67:                                        pr = 1;
                     68:                        } else
                     69:                                pr = 1;
                     70:                }
                     71:            }
                     72:        if (pr != 0)
                     73:                kprintf("q[%4d ] key=%6d,next=%6d,qprev=%6d\n",
                     74:                        i, qp->qkey, qp->qnext, qp->qprev);
                     75:        }
                     76: }

unix.superglobalmegacorp.com

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