root / lab4 / .minix-src / include / minix / rs.h @ 14
History | View | Annotate | Download (6.82 KB)
1 |
#ifndef RS_H
|
---|---|
2 |
#define RS_H
|
3 |
|
4 |
/*
|
5 |
minix/rs.h
|
6 |
|
7 |
Interface to the reincarnation server
|
8 |
*/
|
9 |
|
10 |
#include <minix/bitmap.h> |
11 |
#include <minix/com.h> |
12 |
#include <minix/ipc_filter.h> |
13 |
|
14 |
#define SERVICE_LOGIN "service" /* passwd file entry for services */ |
15 |
|
16 |
/* The following definition should be kept in sync with the actual
|
17 |
* /etc/master.passwd value for SERVICE_LOGIN for now, and removed altogether
|
18 |
* once we are able to obtain its value dynamically everywhere. The value has
|
19 |
* been chosen so as to avoid creating conflicts with future NetBSD additions
|
20 |
* to the password files, although one can never be sure.
|
21 |
*/
|
22 |
#define SERVICE_UID 999 /* user ID for services */ |
23 |
|
24 |
/* RSS definitions. */
|
25 |
#define RSS_NR_IRQ 16 |
26 |
#define RSS_NR_IO 16 |
27 |
#define RSS_IRQ_ALL (RSS_NR_IRQ+1) |
28 |
#define RSS_IO_ALL (RSS_NR_IO+1) |
29 |
#define RSS_IPC_ALL "IPC_ALL" |
30 |
#define RSS_IPC_ALL_SYS "IPC_ALL_SYS" |
31 |
|
32 |
/* RSS flags. */
|
33 |
#define RSS_COPY 0x01 /* keep an in-memory copy of the binary */ |
34 |
#define RSS_REUSE 0x04 /* Try to reuse previously copied binary */ |
35 |
#define RSS_NOBLOCK 0x08 /* unblock caller immediately */ |
36 |
#define RSS_REPLICA 0x10 /* keep a replica of the service */ |
37 |
#define RSS_BATCH 0x20 /* batch mode */ |
38 |
#define RSS_SELF_LU 0x40 /* perform self update */ |
39 |
#define RSS_ASR_LU 0x80 /* perform ASR update */ |
40 |
#define RSS_FORCE_SELF_LU 0x0100 /* force self update */ |
41 |
#define RSS_PREPARE_ONLY_LU 0x0200 /* request prepare-only update */ |
42 |
#define RSS_FORCE_INIT_CRASH 0x0400 /* force crash at initialization time (for debugging) */ |
43 |
#define RSS_FORCE_INIT_FAIL 0x0800 /* force failure at initialization time (for debugging) */ |
44 |
#define RSS_FORCE_INIT_TIMEOUT 0x1000 /* force timeout at initialization time (for debugging) */ |
45 |
#define RSS_FORCE_INIT_DEFCB 0x2000 /* force default cb at initialization time (for debugging) */ |
46 |
#define RSS_SYS_BASIC_CALLS 0x4000 /* include basic kernel calls */ |
47 |
#define RSS_VM_BASIC_CALLS 0x8000 /* include basic vm calls */ |
48 |
#define RSS_NOMMAP_LU 0x10000 /* don't inherit mmapped regions */ |
49 |
#define RSS_DETACH 0x20000 /* detach on update/restart */ |
50 |
#define RSS_NORESTART 0x40000 /* don't restart */ |
51 |
#define RSS_FORCE_INIT_ST 0x80000 /* force state transfer at initialization time */ |
52 |
#define RSS_NO_BIN_EXP 0x100000 /* suppress binary exponential offset */ |
53 |
|
54 |
/* Common definitions. */
|
55 |
#define RS_NR_CONTROL 8 |
56 |
#define RS_NR_PCI_DEVICE 32 |
57 |
#define RS_NR_PCI_CLASS 4 |
58 |
#define RS_MAX_LABEL_LEN 16 |
59 |
#define RS_MAX_IPCF_STR_LEN (RS_MAX_LABEL_LEN+12) |
60 |
#define RS_MAX_IPC_FILTERS 4 |
61 |
|
62 |
/* CPU special values */
|
63 |
#define RS_CPU_DEFAULT -1 /* use the default cpu or do not change the current one */ |
64 |
#define RS_CPU_BSP -2 /* use the bootstrap cpu */ |
65 |
|
66 |
/* Labels are copied over separately. */
|
67 |
struct rss_label
|
68 |
{ |
69 |
char *l_addr;
|
70 |
size_t l_len; |
71 |
}; |
72 |
|
73 |
struct rs_pci_id {
|
74 |
u16_t vid; |
75 |
u16_t did; |
76 |
u16_t sub_vid; |
77 |
u16_t sub_did; |
78 |
}; |
79 |
#define NO_SUB_VID 0xffff |
80 |
#define NO_SUB_DID 0xffff |
81 |
|
82 |
struct rs_pci_class {
|
83 |
u32_t pciclass; |
84 |
u32_t mask; |
85 |
}; |
86 |
|
87 |
/* State-related data. */
|
88 |
struct rs_ipc_filter_el {
|
89 |
int flags;
|
90 |
char m_label[RS_MAX_LABEL_LEN];
|
91 |
int m_type;
|
92 |
}; |
93 |
struct rs_state_data {
|
94 |
size_t size; |
95 |
void *ipcf_els;
|
96 |
size_t ipcf_els_size; |
97 |
int ipcf_els_gid;
|
98 |
void *eval_addr;
|
99 |
size_t eval_len; |
100 |
int eval_gid;
|
101 |
}; |
102 |
|
103 |
/* Arguments needed to start a new driver or server */
|
104 |
struct rs_start
|
105 |
{ |
106 |
unsigned rss_flags;
|
107 |
char *rss_cmd;
|
108 |
size_t rss_cmdlen; |
109 |
uid_t rss_uid; |
110 |
endpoint_t rss_sigmgr; |
111 |
endpoint_t rss_scheduler; |
112 |
int rss_priority;
|
113 |
int rss_quantum;
|
114 |
int rss_major;
|
115 |
long rss_period;
|
116 |
char *rss_script;
|
117 |
size_t rss_scriptlen; |
118 |
long rss_asr_count;
|
119 |
long rss_restarts;
|
120 |
long rss_heap_prealloc_bytes;
|
121 |
long rss_map_prealloc_bytes;
|
122 |
int rss_nr_irq;
|
123 |
int rss_irq[RSS_NR_IRQ];
|
124 |
int rss_nr_io;
|
125 |
struct { unsigned base; unsigned len; } rss_io[RSS_NR_IO]; |
126 |
int rss_nr_pci_id;
|
127 |
struct rs_pci_id rss_pci_id[RS_NR_PCI_DEVICE];
|
128 |
int rss_nr_pci_class;
|
129 |
struct rs_pci_class rss_pci_class[RS_NR_PCI_CLASS];
|
130 |
bitchunk_t rss_system[SYS_CALL_MASK_SIZE]; |
131 |
struct rss_label rss_label;
|
132 |
struct rss_label rss_trg_label;
|
133 |
char *rss_ipc;
|
134 |
size_t rss_ipclen; |
135 |
bitchunk_t rss_vm[VM_CALL_MASK_SIZE]; |
136 |
int rss_nr_control;
|
137 |
struct rss_label rss_control[RS_NR_CONTROL];
|
138 |
struct rs_state_data rss_state_data;
|
139 |
int devman_id;
|
140 |
char *rss_progname;
|
141 |
size_t rss_prognamelen; |
142 |
int rss_nr_domain;
|
143 |
int rss_domain[NR_DOMAIN];
|
144 |
/*
|
145 |
* SMP specific data
|
146 |
*
|
147 |
* must be at the end of the structure for binary compatibility with
|
148 |
* non-smp sysytems
|
149 |
*/
|
150 |
int rss_cpu;
|
151 |
}; |
152 |
|
153 |
/* ACL information for access to PCI devices */
|
154 |
struct rs_pci
|
155 |
{ |
156 |
char rsp_label[RS_MAX_LABEL_LEN];
|
157 |
int rsp_endpoint;
|
158 |
int rsp_nr_device;
|
159 |
struct rs_pci_id rsp_device[RS_NR_PCI_DEVICE];
|
160 |
int rsp_nr_class;
|
161 |
struct rs_pci_class rsp_class[RS_NR_PCI_CLASS];
|
162 |
}; |
163 |
|
164 |
/* Definition of a public entry of the system process table. */
|
165 |
struct rprocpub {
|
166 |
short in_use; /* set when the entry is in use */ |
167 |
unsigned sys_flags; /* sys flags */ |
168 |
endpoint_t endpoint; /* process endpoint number */
|
169 |
endpoint_t old_endpoint; /* old instance endpoint number (for VM, when updating) */
|
170 |
endpoint_t new_endpoint; /* new instance endpoint number (for VM, when updating) */
|
171 |
|
172 |
devmajor_t dev_nr; /* major device number or NO_DEV */
|
173 |
int nr_domain; /* number of socket driver domains */ |
174 |
int domain[NR_DOMAIN]; /* set of socket driver domains */ |
175 |
|
176 |
char label[RS_MAX_LABEL_LEN]; /* label of this service */ |
177 |
char proc_name[RS_MAX_LABEL_LEN]; /* process name of this service */ |
178 |
|
179 |
bitchunk_t vm_call_mask[VM_CALL_MASK_SIZE]; /* vm call mask */
|
180 |
|
181 |
struct rs_pci pci_acl; /* pci acl */ |
182 |
int devman_id;
|
183 |
}; |
184 |
|
185 |
/* Return whether the given boot process is a user process, as opposed to a
|
186 |
* system process. Only usable by core services during SEF initialization.
|
187 |
*/
|
188 |
#define IS_RPUB_BOOT_USR(rpub) ((rpub)->endpoint == INIT_PROC_NR)
|
189 |
|
190 |
/* Sys flag values. */
|
191 |
#define SF_CORE_SRV 0x001 /* set for core system services */ |
192 |
#define SF_SYNCH_BOOT 0X002 /* set when process needs synch boot init */ |
193 |
#define SF_NEED_COPY 0x004 /* set when process needs copy to start */ |
194 |
#define SF_USE_COPY 0x008 /* set when process has a copy in memory */ |
195 |
#define SF_NEED_REPL 0x010 /* set when process needs replica to start */ |
196 |
#define SF_USE_REPL 0x020 /* set when process has a replica */ |
197 |
#define SF_VM_UPDATE 0x040 /* set when process needs vm update */ |
198 |
#define SF_VM_ROLLBACK 0x080 /* set when vm update is a rollback */ |
199 |
#define SF_VM_NOMMAP 0x100 /* set when vm update ignores mmapped regions */ |
200 |
#define SF_USE_SCRIPT 0x200 /* set when process has restart script */ |
201 |
#define SF_DET_RESTART 0x400 /* set when process detaches on restart */ |
202 |
#define SF_NORESTART 0x800 /* set when process should not be restarted */ |
203 |
#define SF_NO_BIN_EXP 0x1000 /* set when we should ignore binary exp. offset */ |
204 |
|
205 |
#define IMM_SF \
|
206 |
(SF_NO_BIN_EXP | SF_CORE_SRV | SF_SYNCH_BOOT | SF_NEED_COPY | SF_NEED_REPL) /* immutable */
|
207 |
|
208 |
int minix_rs_lookup(const char *name, endpoint_t *value); |
209 |
|
210 |
#endif
|