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

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: /*------------------------------------------------------------------------
        !            18:  *  prdumph  --  dump the active process table entries
        !            19:  *------------------------------------------------------------------------
        !            20:  */
        !            21: prdumph()
        !            22: {
        !            23:        pxdump(0);
        !            24: }
        !            25: 
        !            26: /*------------------------------------------------------------------------
        !            27:  *  prdumpa  --  dump the process table entries printing all entries
        !            28:  *------------------------------------------------------------------------
        !            29:  */
        !            30: prdumpa()
        !            31: {
        !            32:        pxdump(1);
        !            33: }
        !            34: static pxdump(all)
        !            35: int all;
        !            36: {
        !            37:         int i, j, ctr;
        !            38:         PStype ps;
        !            39:         struct pentry *pptr;
        !            40:         disable(ps);
        !            41:         kprintf("\nProctab at loc %o\ncurrpid is %d\n", proctab, currpid);
        !            42:        for ( i=0 ; i<NPROC ; i++ ) {
        !            43:             pptr = &proctab[i];
        !            44:            if (all!=0 || pptr->pstate!=PRFREE) {
        !            45:                 kprintf("\nProcess %d: ",i);
        !            46:                 kprintf("state=%o,name=",pptr->pstate);
        !            47:                 for ( j=0 ; j<PNMLEN ; j++ ) {
        !            48:                         if (pptr->pname[j]=='\0') break;
        !            49:                         kprintf("%c",pptr->pname[j]);
        !            50:                 }
        !            51:                 kprintf(",prio=%d,sem=%d,stk:base=%o,limit=%o,",
        !            52:                        pptr->pprio,pptr->psem,pptr->pbase,pptr->plimit);
        !            53:                kprintf("MAGIC=%o\n", *((int *)pptr->pbase) );
        !            54:                 for ( j=0 ; j<PNREGS ; j++ )
        !            55:                         kprintf("(R%c)%o ","01234567S"[j],pptr->pregs[j]);
        !            56:                 kprintf("\n");
        !            57:            }
        !            58:        }
        !            59:        kprintf("rdyhead:");
        !            60:        ctr = NPROC;
        !            61:         for ( i = q[rdyhead].qnext; i < NPROC ; i=q[i].qnext) {
        !            62:                 kprintf("%d ",i);
        !            63:                if (q[i].qnext == i) {
        !            64:                        kprintf("\nLOOP in ready list");
        !            65:                        break;
        !            66:                }
        !            67:                if (--ctr < 0) {
        !            68:                        kprintf("\nCorrupt ready list -- too long");
        !            69:                        break;
        !            70:                }
        !            71:        }
        !            72:         kprintf("\n");
        !            73:         restore(ps);
        !            74: }

unix.superglobalmegacorp.com

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