coverity appeasement
[minix.git] / kernel / system / do_schedule.c
blob799f8064fde84b1a0f959b24a4a29f4e58468849
1 #include "kernel/system.h"
2 #include <minix/endpoint.h>
3 #include "kernel/clock.h"
5 /*===========================================================================*
6 * do_schedule *
7 *===========================================================================*/
8 int do_schedule(struct proc * caller, message * m_ptr)
10 struct proc *p;
11 int proc_nr;
12 int priority, quantum, cpu;
14 if (!isokendpt(m_ptr->SCHEDULING_ENDPOINT, &proc_nr))
15 return EINVAL;
17 p = proc_addr(proc_nr);
19 /* Only this process' scheduler can schedule it */
20 if (caller != p->p_scheduler)
21 return(EPERM);
23 /* Try to schedule the process. */
24 priority = (int) m_ptr->SCHEDULING_PRIORITY;
25 quantum = (int) m_ptr->SCHEDULING_QUANTUM;
26 cpu = (int) m_ptr->SCHEDULING_CPU;
28 return sched_proc(p, priority, quantum, cpu);