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

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: 
1.1.1.2 ! root       22: #ifdef DEBUG
        !            23:        dotrace("_ptclear", &ptptr, 3);
        !            24: #endif
1.1       root       25:        ptptr->ptstate = PTLIMBO;
                     26:        ptptr->ptseq++;
                     27:        if ( (p=ptptr->pthead) != (struct ptnode *)NULL ) {
1.1.1.2 ! root       28:                for(; p != (struct ptnode *) NULL ; p=p->ptnext)
1.1       root       29:                        (*dispose)( p->ptmsg );
                     30:                (ptptr->pttail)->ptnext = ptfree;
                     31:                ptfree = ptptr->pthead;
                     32:        }
                     33:        if (newstate == PTALLOC) {
1.1.1.2 ! root       34:                ptptr->pttail = ptptr->pthead = (struct ptnode *) NULL;
1.1       root       35:                sreset(ptptr->ptssem, ptptr->ptmaxcnt);
                     36:                sreset(ptptr->ptrsem, 0);
                     37:        } else {
                     38:                sdelete(ptptr->ptssem);
                     39:                sdelete(ptptr->ptrsem);
                     40:        }
                     41:        ptptr->ptstate = newstate;
                     42: }

unix.superglobalmegacorp.com

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