xref: /minix/minix/servers/rs/type.h (revision e4d99eb9)
1 /* Type definitions used in RS.
2  */
3 #ifndef RS_TYPE_H
4 #define RS_TYPE_H
5 
6 /* Definition of an entry of the boot image priv table. */
7 struct boot_image_priv {
8   endpoint_t endpoint;         /* process endpoint number */
9   char label[RS_MAX_LABEL_LEN]; /* label to assign to this service */
10 
11   int flags;                   /* privilege flags */
12 };
13 
14 /* Definition of an entry of the boot image sys table. */
15 struct boot_image_sys {
16   endpoint_t endpoint;         /* process endpoint number */
17 
18   int flags;                   /* system flags */
19 };
20 
21 /* Definition of an entry of the boot image dev table. */
22 struct boot_image_dev {
23   endpoint_t endpoint;         /* process endpoint number */
24 
25   dev_t dev_nr;                /* major device number */
26 };
27 
28 /* Definition of the update descriptors. */
29 struct rproc;
30 struct rprocupd {
31   int lu_flags;		   /* user-specified live update flags */
32   int init_flags;		   /* user-specified init flags */
33   int prepare_state;       /* the state the process has to prepare for the update */
34   endpoint_t state_endpoint; /* the custom process to transfer the state from (if any). */
35   clock_t prepare_tm;      /* timestamp of when the update was scheduled */
36   clock_t prepare_maxtime; /* max time to wait for the process to be ready */
37   struct rproc *rp;        /* the process under update */
38   struct rs_state_data prepare_state_data; /* state data for the update */
39   cp_grant_id_t prepare_state_data_gid; /* state data gid */
40   struct rprocupd *prev_rpupd;   /* the previous process under update */
41   struct rprocupd *next_rpupd;   /* the next process under update */
42 };
43 struct rupdate {
44   int flags;               /* flags to keep track of the status of the update */
45   int num_rpupds;          /* number of descriptors scheduled for the update */
46   int num_init_ready_pending;   /* number of pending init ready messages */
47   struct rprocupd *curr_rpupd;  /* the current descriptor under update */
48   struct rprocupd *first_rpupd; /* first descriptor scheduled for the update */
49   struct rprocupd *last_rpupd;  /* last descriptor scheduled for the update */
50   struct rprocupd *vm_rpupd;    /* VM descriptor scheduled for the update */
51   struct rprocupd *rs_rpupd;    /* RS descriptor scheduled for the update */
52 };
53 
54 /* Definition of an entry of the system process table. */
55 typedef struct priv ixfer_priv_s;
56 struct rproc {
57   struct rprocpub *r_pub;       /* pointer to the corresponding public entry */
58   struct rproc *r_old_rp;       /* pointer to the slot with the old version */
59   struct rproc *r_new_rp;       /* pointer to the slot with the new version */
60   struct rproc *r_prev_rp;      /* pointer to the slot with the prev replica */
61   struct rproc *r_next_rp;      /* pointer to the slot with the next replica */
62   struct rprocupd r_upd;        /* update descriptor */
63   pid_t r_pid;			/* process id, -1 if the process is not there */
64 
65   int r_asr_count;		/* number of live updates with ASR */
66   int r_restarts;		/* number of restarts (initially zero) */
67   long r_backoff;		/* number of periods to wait before revive */
68   unsigned r_flags; 		/* status and policy flags */
69   int r_init_err;               /* error code at initialization time */
70 
71   long r_period;		/* heartbeat period (or zero) */
72   clock_t r_check_tm;		/* timestamp of last check */
73   clock_t r_alive_tm;		/* timestamp of last heartbeat */
74   clock_t r_stop_tm;		/* timestamp of SIGTERM signal */
75   endpoint_t r_caller;		/* RS_LATEREPLY caller */
76   int r_caller_request;		/* RS_LATEREPLY caller request */
77 
78   char r_cmd[MAX_COMMAND_LEN];	/* raw command plus arguments */
79   char r_args[MAX_COMMAND_LEN];	/* null-separated raw command plus arguments */
80 #define ARGV_ELEMENTS (MAX_NR_ARGS+2) /* path, args, null */
81   char *r_argv[ARGV_ELEMENTS];
82   int r_argc;  			/* number of arguments */
83   char r_script[MAX_SCRIPT_LEN]; /* name of the restart script executable */
84 
85   char *r_exec;			/* Executable image */
86   size_t r_exec_len;		/* Length of image */
87 
88   ixfer_priv_s r_priv;		/* Privilege structure to be passed to the
89 				 * kernel.
90 				 */
91   uid_t r_uid;
92   endpoint_t r_scheduler;	/* scheduler */
93   int r_priority;		/* negative values are reserved for special meanings */
94   int r_quantum;
95   int r_cpu;
96   vir_bytes r_map_prealloc_addr; /* preallocated mmap address */
97   size_t r_map_prealloc_len;     /* preallocated mmap len */
98 
99   /* Backup values from the privilege structure. */
100   struct io_range r_io_tab[NR_IO_RANGE];
101   int r_nr_io_range;
102   int r_irq_tab[NR_IRQ];
103   int r_nr_irq;
104 
105   char r_ipc_list[MAX_IPC_LIST];
106   int r_nr_control;
107   char r_control[RS_NR_CONTROL][RS_MAX_LABEL_LEN];
108 };
109 
110 #endif /* RS_TYPE_H */
111 
112 
113