|
|
1.1 root 1: /* send.c - send */
2:
3: #include <conf.h>
4: #include <kernel.h>
5: #include <proc.h>
6:
7: /*------------------------------------------------------------------------
8: * send -- send a message to another process
9: *------------------------------------------------------------------------
10: */
11: SYSCALL send(pid, msg)
12: int pid;
1.1.1.2 ! root 13: WORD msg;
1.1 root 14: {
1.1.1.2 ! root 15: struct pentry *pptr;
1.1 root 16:
1.1.1.2 ! root 17: disable();
1.1 root 18: if (isbadpid(pid) || ( (pptr= &proctab[pid])->pstate == PRFREE)
1.1.1.2 ! root 19: || pptr->phasmsg != 0) {
! 20: restore();
1.1 root 21: return(SYSERR);
22: }
1.1.1.2 ! root 23: pptr->pmsg = msg;
! 24: pptr->phasmsg++;
! 25: if (pptr->pstate == PRRECV)
1.1 root 26: ready(pid, RESCHYES);
27: return(OK);
28: }
This archive runs on limited infrastructure. Preserving old code on modern bandwidth. Automated agents are requested to crawl responsibly.