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

1.1     ! root        1: /* pinit.c - pinit */
        !             2: 
        !             3: #include <conf.h>
        !             4: #include <kernel.h>
        !             5: #include <mark.h>
        !             6: #include <ports.h>
        !             7: 
        !             8: #ifdef MEMMARK
        !             9: MARKER ptmark;
        !            10: #endif
        !            11: struct ptnode  *ptfree;                /* list of free queue nodes     */
        !            12: struct pt      ports[NPORTS];
        !            13: int    ptnextp;
        !            14: 
        !            15: /*------------------------------------------------------------------------
        !            16:  *  pinit  --  initialize all ports
        !            17:  *------------------------------------------------------------------------
        !            18:  */
        !            19: SYSCALL        pinit(maxmsgs)
        !            20: int maxmsgs;
        !            21: {
        !            22:        int     i;
        !            23:        struct  ptnode  *next, *prev;
        !            24: 
        !            25:        ptfree = (struct ptnode *) getmem(maxmsgs*sizeof(struct ptnode));
        !            26:        if ( (int)ptfree == SYSERR )
        !            27:                panic("pinit: no  memory");
        !            28:        for (i=0 ; i<NPORTS ; i++) {
        !            29:                ports[i].ptstate = PTFREE;
        !            30:                ports[i].ptseq = 0;
        !            31:        }
        !            32:        ptnextp = NPORTS - 1;
        !            33: 
        !            34:        /* link up free list of message pointer nodes */
        !            35: 
        !            36:        for ( prev=next=ptfree ;  --maxmsgs > 0  ; prev=next )
        !            37:                prev->ptnext = ++next;
        !            38:        prev->ptnext = (struct ptnode *)NULL;
        !            39:        return(OK);
        !            40: }

unix.superglobalmegacorp.com

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