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

1.1     ! root        1: /* ptclear.c - _ptclear */
        !             2: 
        !             3: #include <conf.h>
        !             4: #include <kernel.h>
        !             5: #include <mark.h>
        !             6: #include <ports.h>
        !             7: 
        !             8: /*------------------------------------------------------------------------
        !             9:  *  _ptclear  --  used by pdelete and preset to clear a port
        !            10:  *------------------------------------------------------------------------
        !            11:  */
        !            12: _ptclear(ptptr, newstate, dispose)
        !            13:        struct  pt      *ptptr;
        !            14:        int     newstate;
        !            15:        int     (*dispose)();
        !            16: {
        !            17:        struct  ptnode  *p;
        !            18: 
        !            19: 
        !            20:        /* put port in limbo until done freeing processes */
        !            21: 
        !            22:        ptptr->ptstate = PTLIMBO;
        !            23:        ptptr->ptseq++;
        !            24:        if ( (p=ptptr->pthead) != (struct ptnode *)NULL ) {
        !            25:                for(; p != (struct ptnode *)NULL ; p=p->ptnext)
        !            26:                        (*dispose)( p->ptmsg );
        !            27:                (ptptr->pttail)->ptnext = ptfree;
        !            28:                ptfree = ptptr->pthead;
        !            29:        }
        !            30:        if (newstate == PTALLOC) {
        !            31:                ptptr->pttail = ptptr->pthead = (struct ptnode *)NULL;
        !            32:                sreset(ptptr->ptssem, ptptr->ptmaxcnt);
        !            33:                sreset(ptptr->ptrsem, 0);
        !            34:        } else {
        !            35:                sdelete(ptptr->ptssem);
        !            36:                sdelete(ptptr->ptrsem);
        !            37:        }
        !            38:        ptptr->ptstate = newstate;
        !            39: }

unix.superglobalmegacorp.com

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