|
|
Xinu for 68000/68010
/* suspend.c - suspend */
#include <conf.h>
#include <kernel.h>
#include <proc.h>
/*------------------------------------------------------------------------
* suspend -- suspend a process, placing it in hibernation
*------------------------------------------------------------------------
*/
SYSCALL suspend(pid)
int pid; /* id of process to suspend */
{
struct pentry *pptr; /* pointer to proc. tab. entry */
int prio; /* priority returned */
disable();
if (isbadpid(pid) || pid==NULLPROC ||
((pptr= &proctab[pid])->pstate!=PRCURR && pptr->pstate!=PRREADY)) {
restore();
return(SYSERR);
}
if (pptr->pstate == PRREADY) {
pptr->pstate = PRSUSP;
dequeue(pid);
}
else {
pptr->pstate = PRSUSP;
resched();
}
prio = pptr->pprio;
restore();
return(prio);
}
This archive runs on limited infrastructure. Preserving old code on modern bandwidth. Automated agents are requested to crawl responsibly.