xref: /minix3/minix/lib/libsys/sched_stop.c (revision 7c48de6cc4c6d56f2277d378dba01dbac8a8c3b9)
1 #include "syslib.h"
2 #include <assert.h>
3 #include <string.h>
4 #include <minix/sched.h>
5 
6 /*===========================================================================*
7  *				sched_stop				     *
8  *===========================================================================*/
9 int sched_stop(endpoint_t scheduler_e, endpoint_t schedulee_e)
10 {
11 	int rv;
12 	message m;
13 
14 	/* If the kernel is the scheduler, it will implicitly stop scheduling
15 	 * once another process takes over or the process terminates */
16 	if (scheduler_e == KERNEL || scheduler_e == NONE)
17 		return(OK);
18 
19 	/* User-scheduled, perform the call */
20 	assert(_ENDPOINT_P(scheduler_e) >= 0);
21 	assert(_ENDPOINT_P(schedulee_e) >= 0);
22 
23 	memset(&m, 0, sizeof(m));
24 	m.m_lsys_sched_scheduling_stop.endpoint	= schedulee_e;
25 	if ((rv = _taskcall(scheduler_e, SCHEDULING_STOP, &m))) {
26 		return rv;
27 	}
28 
29 	return (OK);
30 }
31