xref: /minix/minix/include/minix/priv.h (revision 7f5f010b)
1 /* Privilege-related definitions. */
2 
3 #ifndef _MINIX_PRIV_H
4 #define _MINIX_PRIV_H
5 
6 #include <minix/com.h>
7 #include <minix/config.h>
8 
9 /* Static privilege id definitions. */
10 #define NR_STATIC_PRIV_IDS         NR_BOOT_PROCS
11 #define is_static_priv_id(id)	   (id >= 0 && id < NR_STATIC_PRIV_IDS)
12 #define static_priv_id(n)          (NR_TASKS + (n))
13 
14 /* Unprivileged user processes all share the privilege structure of the
15  * user processesess.
16  * This id must be fixed because it is used to check send mask entries.
17  */
18 #define USER_PRIV_ID	static_priv_id(ROOT_USR_PROC_NR)
19 /* Specifies a null privilege id.
20  */
21 #define NULL_PRIV_ID	(-1)
22 
23 /* Allowed targets. */
24 #define NO_M      (-1)              /* no targets allowed */
25 #define ALL_M     (-2)              /* all targets allowed */
26 
27 /* Allowed calls. */
28 #define NO_C      (-1)              /* no calls allowed */
29 #define ALL_C     (-2)              /* all calls allowed */
30 #define NULL_C    (-3)              /* null call entry */
31 
32 /*
33  * Default privilege settings used in the system
34  */
35 /* privilege flags */
36 #define IDL_F     (SYS_PROC | BILLABLE) /* idle task is not preemptible as we
37                                          * don't want it to interfere with the
38                                          * timer tick interrupt handler code.
39                                          * Unlike other processes idle task is
40                                          * handled in a special way and is
41                                          * preempted always if timer tick occurs
42                                          * and there is another runnable process
43                                          */
44 #define TSK_F     (SYS_PROC)                       /* other kernel tasks */
45 #define SRV_F     (SYS_PROC | PREEMPTIBLE)         /* system services */
46 #define DSRV_F    (SRV_F | DYN_PRIV_ID)            /* dynamic system services */
47 #define RSYS_F    (SRV_F | ROOT_SYS_PROC)          /* root sys proc */
48 #define VM_F      (SYS_PROC | VM_SYS_PROC)         /* vm */
49 #define USR_F     (BILLABLE | PREEMPTIBLE)         /* user processes */
50 #define IMM_F     (ROOT_SYS_PROC | VM_SYS_PROC | PREEMPTIBLE) /* immutable */
51 
52 /* allowed traps */
53 #define CSK_T     (1 << RECEIVE)                   /* clock and system */
54 #define TSK_T     0                                /* other kernel tasks */
55 #define SRV_T     (~0)                             /* system services */
56 #define DSRV_T    (~0)                             /* dynamic system services */
57 #define USR_T     (1 << SENDREC)                   /* user processes */
58 
59 /* allowed targets */
60 #define TSK_M     NO_M                             /* all kernel tasks */
61 #define SRV_M     ALL_M                            /* system services */
62 #define DSRV_M    ALL_M                            /* dynamic system services */
63 #define USR_M     ALL_M                            /* user processes */
64 
65 /* allowed kernel calls */
66 #define TSK_KC    NO_C                             /* all kernel tasks */
67 #define SRV_KC    ALL_C                            /* dynamic system services */
68 #define DSRV_KC   ALL_C                            /* default sys proc */
69 #define USR_KC    NO_C                             /* user processes */
70 
71 /* allowed vm calls */
72 #define SRV_VC    ALL_C                            /* dynamic system services */
73 #define DSRV_VC   ALL_C                            /* default sys proc */
74 #define USR_VC    ALL_C                            /* user processes */
75 
76 /* signal manager */
77 #define SRV_SM    ROOT_SYS_PROC_NR                 /* system services */
78 #define DSRV_SM   ROOT_SYS_PROC_NR                 /* dynamic system services */
79 #define USR_SM    PM_PROC_NR                       /* user processes */
80 
81 /* scheduler */
82 #define SRV_SCH   KERNEL                           /* system services */
83 #define DSRV_SCH  SCHED_PROC_NR                    /* dynamic system services */
84 #define USR_SCH   NONE                             /* user processes */
85 
86 /* scheduling priority queue. */
87 #define SRV_Q     USER_Q                           /* system services */
88 #define DSRV_Q    USER_Q                           /* dynamic system services */
89 #define USR_Q     USER_Q                           /* user processes */
90 
91 /* scheduling quantum. */
92 #define SRV_QT    USER_QUANTUM                     /* system services */
93 #define DSRV_QT   USER_QUANTUM                     /* dynamic system services */
94 #define USR_QT    USER_QUANTUM                     /* user processes */
95 
96 /* default CPU */
97 #define DSRV_CPU USER_DEFAULT_CPU
98 
99 #endif /* _MINIX_PRIV_H */
100