|
|
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:
1.1.1.2 ! root 18: disable();
1.1 root 19: if (isbadpid(pid) || newprio<=0 ||
20: (pptr = &proctab[pid])->pstate == PRFREE) {
1.1.1.2 ! root 21: restore();
1.1 root 22: return(SYSERR);
23: }
24: oldprio = pptr->pprio;
25: pptr->pprio = newprio;
1.1.1.2 ! root 26: if (pptr->pstate == PRREADY) {
! 27: dequeue(pid);
! 28: insert(pid, rdyhead, newprio);
! 29: }
! 30: restore();
1.1 root 31: return(oldprio);
32: }
This archive runs on limited infrastructure. Preserving old code on modern bandwidth. Automated agents are requested to crawl responsibly.