tools/llvm: Do not build with symbols
[minix3.git] / minix / servers / sched / utility.c
blob3755ad1e18b533c0b29960c9daa54c82de5454a0
1 /* This file contains some utility routines for SCHED.
3 * The entry points are:
4 * no_sys: called for invalid system call numbers
5 * sched_isokendpt: check the validity of an endpoint
6 * sched_isemtyendpt check for validity and availability of endpoint slot
7 * accept_message check whether message is allowed
8 */
10 #include "sched.h"
11 #include <machine/archtypes.h>
12 #include <sys/resource.h> /* for PRIO_MAX & PRIO_MIN */
13 #include "kernel/proc.h" /* for queue constants */
14 #include "schedproc.h"
16 /*===========================================================================*
17 * no_sys *
18 *===========================================================================*/
19 int no_sys(int who_e, int call_nr)
21 /* A system call number not implemented by PM has been requested. */
22 printf("SCHED: in no_sys, call nr %d from %d\n", call_nr, who_e);
23 return(ENOSYS);
27 /*===========================================================================*
28 * sched_isokendpt *
29 *===========================================================================*/
30 int sched_isokendpt(int endpoint, int *proc)
32 *proc = _ENDPOINT_P(endpoint);
33 if (*proc < 0)
34 return (EBADEPT); /* Don't schedule tasks */
35 if(*proc >= NR_PROCS)
36 return (EINVAL);
37 if(endpoint != schedproc[*proc].endpoint)
38 return (EDEADEPT);
39 if(!(schedproc[*proc].flags & IN_USE))
40 return (EDEADEPT);
41 return (OK);
44 /*===========================================================================*
45 * sched_isemtyendpt *
46 *===========================================================================*/
47 int sched_isemtyendpt(int endpoint, int *proc)
49 *proc = _ENDPOINT_P(endpoint);
50 if (*proc < 0)
51 return (EBADEPT); /* Don't schedule tasks */
52 if(*proc >= NR_PROCS)
53 return (EINVAL);
54 if(schedproc[*proc].flags & IN_USE)
55 return (EDEADEPT);
56 return (OK);
59 /*===========================================================================*
60 * accept_message *
61 *===========================================================================*/
62 int accept_message(message *m_ptr)
64 /* accept all messages from PM and RS */
65 switch (m_ptr->m_source) {
67 case PM_PROC_NR:
68 case RS_PROC_NR:
69 return 1;
73 /* no other messages are allowable */
74 return 0;