|
|
1.1 ! root 1: /* chprio.c - chprio */ ! 2: ! 3: #include <conf.h> ! 4: #include <kernel.h> ! 5: #include <proc.h> ! 6: ! 7: /*------------------------------------------------------------------------ ! 8: * chprio -- change the scheduling priority of a process ! 9: *------------------------------------------------------------------------ ! 10: */ ! 11: SYSCALL chprio(pid,newprio) ! 12: int pid; ! 13: int newprio; /* newprio > 0 */ ! 14: { ! 15: int oldprio; ! 16: struct pentry *pptr; ! 17: PStype ps; ! 18: ! 19: disable(ps); ! 20: if (isbadpid(pid) || newprio<=0 || ! 21: (pptr = &proctab[pid])->pstate == PRFREE) { ! 22: restore(ps); ! 23: return(SYSERR); ! 24: } ! 25: oldprio = pptr->pprio; ! 26: pptr->pprio = newprio; ! 27: switch (pptr->pstate) { ! 28: case PRREADY: ! 29: insert( dequeue(pid), rdyhead, newprio); ! 30: case PRCURR: ! 31: resched(); ! 32: default: ! 33: break; ! 34: } ! 35: restore(ps); ! 36: return(oldprio); ! 37: }
This archive runs on limited infrastructure. Preserving old code on modern bandwidth. Automated agents are requested to crawl responsibly.