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

1.1       root        1: /* pcount.c - pcount */
                      2: 
                      3: #include <conf.h>
                      4: #include <kernel.h>
                      5: #include <mark.h>
                      6: #include <ports.h>
                      7: 
                      8: /*------------------------------------------------------------------------
                      9:  *  pcount  --  return the count of current messages in a port
                     10:  *------------------------------------------------------------------------
                     11:  */
                     12: SYSCALL        pcount(portid)
                     13: int    portid;
                     14: {
                     15:        int     scnt;
                     16:        int     count;
                     17:        struct  pt      *ptptr;
                     18: 
1.1.1.2 ! root       19: #ifdef DEBUG
        !            20:        dotrace("pcount", &portid, 1);
        !            21: #endif
        !            22:        disable();
1.1       root       23:        if ( isbadport(portid) ||
                     24: #ifdef MEMMARK
                     25:                unmarked(ptmark) ||
                     26: #endif
                     27:                (ptptr= &ports[portid])->ptstate != PTALLOC ) {
1.1.1.2 ! root       28:                        restore();
1.1       root       29:                        return(SYSERR);
                     30:        }
                     31:        count = scount(ptptr->ptrsem);
                     32:        if ( (scnt=scount(ptptr->ptssem)) < 0 )
                     33:                count -= scnt;                  /* add number waiting   */
1.1.1.2 ! root       34:        restore();
1.1       root       35:        return(count);
                     36: }

unix.superglobalmegacorp.com

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