--- xinu/sys/kill.c 2018/04/24 17:39:04 1.1 +++ xinu/sys/kill.c 2018/04/24 17:40:06 1.1.1.2 @@ -5,7 +5,6 @@ #include #include #include -#include /*------------------------------------------------------------------------ * kill -- kill a process and remove it from the system @@ -15,42 +14,27 @@ SYSCALL kill(pid) int pid; /* process to kill */ { struct pentry *pptr; /* points to proc. table for pid*/ - int dev; - PStype ps; - disable(ps); + disable(); if (isbadpid(pid) || (pptr= &proctab[pid])->pstate==PRFREE) { - restore(ps); + restore(); return(SYSERR); } if (--numproc == 0) xdone(); - dev = pptr->pdevs[0]; - if (! isbaddev(dev) ) - close(dev); - dev = pptr->pdevs[1]; - if (! isbaddev(dev) ) - close(dev); - send(pptr->pnxtkin, pid); freestk(pptr->pbase, pptr->pstklen); switch (pptr->pstate) { - case PRCURR: pptr->pstate = PRFREE; /* suicide */ + case PRCURR: pptr->pstate = PRFREE; /* suicide */ resched(); - case PRWAIT: semaph[pptr->psem].semcnt++; - /* fall through */ - case PRREADY: dequeue(pid); - pptr->pstate = PRFREE; - break; - -#ifdef RTCLOCK - case PRSLEEP: - case PRTRECV: unsleep(pid); -#endif - /* fall through */ - default: pptr->pstate = PRFREE; + case PRWAIT: semaph[pptr->psem].semcnt++; + + case PRSLEEP: + case PRREADY: dequeue(pid); + + default: pptr->pstate = PRFREE; } - restore(ps); + restore(); return(OK); }