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

1.1       root        1: /* signal.c - signal */
                      2: 
                      3: #include <conf.h>
                      4: #include <kernel.h>
                      5: #include <proc.h>
                      6: #include <q.h>
                      7: #include <sem.h>
                      8: 
                      9: /*------------------------------------------------------------------------
                     10:  * signal  --  signal a semaphore, releasing one waiting process
                     11:  *------------------------------------------------------------------------
                     12:  */
                     13: SYSCALL signal(sem)
1.1.1.2 ! root       14:        int     sem;
1.1       root       15: {
                     16:        register struct sentry  *sptr;
                     17: 
1.1.1.2 ! root       18:        disable();
1.1       root       19:        if (isbadsem(sem) || (sptr= &semaph[sem])->sstate==SFREE) {
1.1.1.2 ! root       20:                restore();
1.1       root       21:                return(SYSERR);
                     22:        }
                     23:        if ((sptr->semcnt++) < 0)
                     24:                ready(getfirst(sptr->sqhead), RESCHYES);
1.1.1.2 ! root       25:        restore();
1.1       root       26:        return(OK);
                     27: }

unix.superglobalmegacorp.com

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