|
|
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: PStype ps; ! 18: struct pt *ptptr; ! 19: ! 20: disable(ps); ! 21: if ( isbadport(portid) || ! 22: #ifdef MEMMARK ! 23: unmarked(ptmark) || ! 24: #endif ! 25: (ptptr= &ports[portid])->ptstate != PTALLOC ) { ! 26: restore(ps); ! 27: return(SYSERR); ! 28: } ! 29: count = scount(ptptr->ptrsem); ! 30: if ( (scnt=scount(ptptr->ptssem)) < 0 ) ! 31: count -= scnt; /* add number waiting */ ! 32: restore(ps); ! 33: return(count); ! 34: }
This archive runs on limited infrastructure. Preserving old code on modern bandwidth. Automated agents are requested to crawl responsibly.