Project

General

Profile

Statistics
| Revision:

root / lab4 / .minix-src / include / minix / priv.h @ 13

History | View | Annotate | Download (4.75 KB)

1 13 up20180614
/* 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
/* init flags */
53
#define TSK_I     0                               /* all kernel tasks */
54
#define SRV_I     0                               /* system services */
55
#define DSRV_I    0                               /* dynamic system services */
56
#define USR_I     0                               /* user processes */
57
58
/* allowed traps */
59
#define CSK_T     (1 << RECEIVE)                   /* clock and system */
60
#define TSK_T     0                                /* other kernel tasks */
61
#define SRV_T     (~0)                             /* system services */
62
#define DSRV_T    (~0)                             /* dynamic system services */
63
#define USR_T     (1 << SENDREC)                   /* user processes */
64
65
/* allowed targets */
66
#define TSK_M     NO_M                             /* all kernel tasks */
67
#define SRV_M     ALL_M                            /* system services */
68
#define DSRV_M    ALL_M                            /* dynamic system services */
69
#define USR_M     ALL_M                            /* user processes */
70
71
/* allowed kernel calls */
72
#define TSK_KC    NO_C                             /* all kernel tasks */
73
#define SRV_KC    ALL_C                            /* dynamic system services */
74
#define DSRV_KC   ALL_C                            /* default sys proc */
75
#define USR_KC    NO_C                             /* user processes */
76
77
/* allowed vm calls */
78
#define SRV_VC    ALL_C                            /* dynamic system services */
79
#define DSRV_VC   ALL_C                            /* default sys proc */
80
#define USR_VC    ALL_C                            /* user processes */
81
82
/* signal manager */
83
#define SRV_SM    ROOT_SYS_PROC_NR                 /* system services */
84
#define DSRV_SM   ROOT_SYS_PROC_NR                 /* dynamic system services */
85
#define USR_SM    PM_PROC_NR                       /* user processes */
86
87
/* scheduler */
88
#define SRV_SCH   KERNEL                           /* system services */
89
#define DSRV_SCH  SCHED_PROC_NR                    /* dynamic system services */
90
#define USR_SCH   NONE                             /* user processes */
91
92
/* scheduling priority queue. */
93
#define SRV_Q     USER_Q                           /* system services */
94
#define DSRV_Q    USER_Q                           /* dynamic system services */
95
#define USR_Q     USER_Q                           /* user processes */
96
97
/* scheduling quantum. */
98
#define SRV_QT    USER_QUANTUM                     /* system services */
99
#define DSRV_QT   USER_QUANTUM                     /* dynamic system services */
100
#define USR_QT    USER_QUANTUM                     /* user processes */
101
102
/* default CPU */
103
#define DSRV_CPU USER_DEFAULT_CPU
104
105
#endif /* _MINIX_PRIV_H */