Remove building with NOCRYPTO option
[minix3.git] / minix / servers / sched / utility.c
blobf05bf8886136cb2cd860462b2ad2c4c87aa3ecc4
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 "schedproc.h"
15 /*===========================================================================*
16 * no_sys *
17 *===========================================================================*/
18 int no_sys(int who_e, int call_nr)
20 /* A system call number not implemented by PM has been requested. */
21 printf("SCHED: in no_sys, call nr %d from %d\n", call_nr, who_e);
22 return(ENOSYS);
26 /*===========================================================================*
27 * sched_isokendpt *
28 *===========================================================================*/
29 int sched_isokendpt(int endpoint, int *proc)
31 *proc = _ENDPOINT_P(endpoint);
32 if (*proc < 0)
33 return (EBADEPT); /* Don't schedule tasks */
34 if(*proc >= NR_PROCS)
35 return (EINVAL);
36 if(endpoint != schedproc[*proc].endpoint)
37 return (EDEADEPT);
38 if(!(schedproc[*proc].flags & IN_USE))
39 return (EDEADEPT);
40 return (OK);
43 /*===========================================================================*
44 * sched_isemtyendpt *
45 *===========================================================================*/
46 int sched_isemtyendpt(int endpoint, int *proc)
48 *proc = _ENDPOINT_P(endpoint);
49 if (*proc < 0)
50 return (EBADEPT); /* Don't schedule tasks */
51 if(*proc >= NR_PROCS)
52 return (EINVAL);
53 if(schedproc[*proc].flags & IN_USE)
54 return (EDEADEPT);
55 return (OK);
58 /*===========================================================================*
59 * accept_message *
60 *===========================================================================*/
61 int accept_message(message *m_ptr)
63 /* accept all messages from PM and RS */
64 switch (m_ptr->m_source) {
66 case PM_PROC_NR:
67 case RS_PROC_NR:
68 return 1;
72 /* no other messages are allowable */
73 return 0;