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