Category : C Source Code
Archive   : XINU.ZIP
Filename : KILL.C
# include
# include
# include
# include
# include
/*-----------------------------------------------------------------------------
* kill -- kill a process and remove it from the system
*-----------------------------------------------------------------------------
*/
SYSCALL kill(pid)
int pid; /* process to kill */
{
struct pentry *pptr; /* points to process table for pid */
char ps; /* saved processor status */
disable(ps);
if (isbadpid(pid) || (pptr= &proctab[pid])->pstate==PRFREE) {
restore(ps);
return(SYSERR);
}
if (--numproc == 0)
xdone();
freestk(pptr->pbase, pptr->pstklen);
switch (pptr->pstate) {
case PRCURR: pptr->pstate = PRFREE; /* suicide */
resched();
case PRWAIT: semaph[pptr->psem].semcnt++;
case PRSLEEP:
case PRREADY: dequeue(pid);
default: pptr->pstate = PRFREE;
}
restore(ps);
return(OK);
}
Very nice! Thank you for this wonderful archive. I wonder why I found it only now. Long live the BBS file archives!
This is so awesome! 😀 I’d be cool if you could download an entire archive of this at once, though.
But one thing that puzzles me is the “mtswslnkmcjklsdlsbdmMICROSOFT” string. There is an article about it here. It is definitely worth a read: http://www.os2museum.com/wp/mtswslnk/