minix/kernel/system/do_schedule.c
Lionel Sambuc b694a09a53 Message type for SCHEDULING_NO_QUANTUM, SYS_SCHEDULE
Change-Id: Ia0f2689067159b4d821092d4ac60efa75e396f7c
2014-07-28 17:05:42 +02:00

29 lines
817 B
C

#include "kernel/system.h"
#include <minix/endpoint.h>
#include "kernel/clock.h"
/*===========================================================================*
* do_schedule *
*===========================================================================*/
int do_schedule(struct proc * caller, message * m_ptr)
{
struct proc *p;
int proc_nr;
int priority, quantum, cpu;
if (!isokendpt(m_ptr->m_lsys_krn_schedule.endpoint, &proc_nr))
return EINVAL;
p = proc_addr(proc_nr);
/* Only this process' scheduler can schedule it */
if (caller != p->p_scheduler)
return(EPERM);
/* Try to schedule the process. */
priority = m_ptr->m_lsys_krn_schedule.priority;
quantum = m_ptr->m_lsys_krn_schedule.quantum;
cpu = m_ptr->m_lsys_krn_schedule.cpu;
return sched_proc(p, priority, quantum, cpu);
}