Annotation of xinu/sys/prdump.c, revision 1.1.1.2

1.1       root        1: /* prdump.c - prdump, prdumph, prdumpa */
                      2: 
                      3: #include <conf.h>
                      4: #include <kernel.h>
                      5: #include <proc.h>
                      6: #include <q.h>
                      7: 
                      8: /*------------------------------------------------------------------------
                      9:  *  prdump  --  dump the active process table entries
                     10:  *------------------------------------------------------------------------
                     11:  */
                     12: prdump()
                     13: {
                     14:        pxdump(0);
                     15: }
                     16: 
                     17: /*------------------------------------------------------------------------
1.1.1.2 ! root       18:  *  prdumph  --  dump the active process table entries and halt
1.1       root       19:  *------------------------------------------------------------------------
                     20:  */
                     21: prdumph()
                     22: {
                     23:        pxdump(0);
1.1.1.2 ! root       24:        kprintf("\nDump complete -- type P to continue\n");
        !            25:        halt();
1.1       root       26: }
                     27: 
                     28: /*------------------------------------------------------------------------
                     29:  *  prdumpa  --  dump the process table entries printing all entries
                     30:  *------------------------------------------------------------------------
                     31:  */
                     32: prdumpa()
                     33: {
                     34:        pxdump(1);
                     35: }
                     36: static pxdump(all)
                     37: int all;
                     38: {
                     39:         int i, j, ctr;
                     40:         struct pentry *pptr;
1.1.1.2 ! root       41:         disable();
        !            42:         kprintf("\nProctab at loc %x\ncurrpid is %d\n", proctab, currpid);
1.1       root       43:        for ( i=0 ; i<NPROC ; i++ ) {
                     44:             pptr = &proctab[i];
                     45:            if (all!=0 || pptr->pstate!=PRFREE) {
                     46:                 kprintf("\nProcess %d: ",i);
1.1.1.2 ! root       47:                 kprintf("state=%x,name=",pptr->pstate);
1.1       root       48:                 for ( j=0 ; j<PNMLEN ; j++ ) {
                     49:                         if (pptr->pname[j]=='\0') break;
                     50:                         kprintf("%c",pptr->pname[j]);
                     51:                 }
1.1.1.2 ! root       52:                 kprintf(",prio=%d,sem=%d,stk:base=%x,limit=%x\n",
1.1       root       53:                        pptr->pprio,pptr->psem,pptr->pbase,pptr->plimit);
1.1.1.2 ! root       54:                 for ( j=0 ; j<PNREGS ; j++ ) {
        !            55:                         kprintf("(%c%c)%x ",
        !            56:                                "DDDDDDDDAAAAAAASPPU"[j],
        !            57:                                "012345670123456PSCP"[j],
        !            58:                                pptr->pregs[j]);
        !            59:                        if ((j + 1) % 4 == 0) kprintf("\n");
        !            60:                }
1.1       root       61:                 kprintf("\n");
                     62:            }
                     63:        }
                     64:        kprintf("rdyhead:");
                     65:        ctr = NPROC;
                     66:         for ( i = q[rdyhead].qnext; i < NPROC ; i=q[i].qnext) {
                     67:                 kprintf("%d ",i);
                     68:                if (q[i].qnext == i) {
                     69:                        kprintf("\nLOOP in ready list");
                     70:                        break;
                     71:                }
                     72:                if (--ctr < 0) {
                     73:                        kprintf("\nCorrupt ready list -- too long");
                     74:                        break;
                     75:                }
                     76:        }
                     77:         kprintf("\n");
1.1.1.2 ! root       78:         restore();
1.1       root       79: }

unix.superglobalmegacorp.com

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