|
|
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: /*------------------------------------------------------------------------
1.1.1.2 ! root 20: * qdumph -- dump the contents of the q structure and halt
1.1 root 21: *------------------------------------------------------------------------
22: */
23: qdumph()
24: {
25: qxdump(0);
1.1.1.2 ! root 26: kprintf("\nDump complete -- type P to continue\n");
! 27: halt();
1.1 root 28: }
29:
30: /*------------------------------------------------------------------------
31: * qdumpa -- dump the contents of the q structure printing all info
32: *------------------------------------------------------------------------
33: */
34: qdumpa()
35: {
36: qxdump(1);
37: }
38:
39: static qxdump(all)
40: int all;
41: {
42: struct qent *qp;
43: int i;
44: struct pentry *pptr;
45: int pr;
46:
47: for (i=0 ; i<NQENT ; i++) {
48: if ( (pr=all) == 0) {
49: qp = &q[i];
50: if (i < NPROC) {
51: pptr = &proctab[i];
52: if (pptr->pstate!=PRFREE)
53: pr = 1;
54: } else { /* normal queue - could be head or tail */
55: if ( (qp->qnext<NPROC && qp->qnext>=0)
56: ||(qp->qprev<NPROC && qp->qprev>=0) )
57: pr = 1;
1.1.1.2 ! root 58: else if (qp->qkey == MAXINT) {
1.1 root 59: if (qp->qnext != EMPTY
60: || isbadq(qp->qprev)
1.1.1.2 ! root 61: || q[qp->qprev].qkey != MININT
1.1 root 62: || q[qp->qprev].qnext != i)
63: pr = 1;
1.1.1.2 ! root 64: } else if (qp->qkey == MININT) {
1.1 root 65: if (qp->qprev != EMPTY
66: || isbadq(qp->qnext)
1.1.1.2 ! root 67: || q[qp->qnext].qkey != MAXINT
1.1 root 68: || q[qp->qnext].qprev != i)
69: pr = 1;
70: } else
71: pr = 1;
72: }
73: }
74: if (pr != 0)
75: kprintf("q[%4d ] key=%6d,next=%6d,qprev=%6d\n",
76: i, qp->qkey, qp->qnext, qp->qprev);
77: }
78: }
This archive runs on limited infrastructure. Preserving old code on modern bandwidth. Automated agents are requested to crawl responsibly.