1433d6423SLionel Sambuc /* Type definitions used in RS. 2433d6423SLionel Sambuc */ 3433d6423SLionel Sambuc #ifndef RS_TYPE_H 4433d6423SLionel Sambuc #define RS_TYPE_H 5433d6423SLionel Sambuc 6433d6423SLionel Sambuc /* Definition of an entry of the boot image priv table. */ 7433d6423SLionel Sambuc struct boot_image_priv { 8433d6423SLionel Sambuc endpoint_t endpoint; /* process endpoint number */ 9433d6423SLionel Sambuc char label[RS_MAX_LABEL_LEN]; /* label to assign to this service */ 10433d6423SLionel Sambuc 11433d6423SLionel Sambuc int flags; /* privilege flags */ 12433d6423SLionel Sambuc }; 13433d6423SLionel Sambuc 14433d6423SLionel Sambuc /* Definition of an entry of the boot image sys table. */ 15433d6423SLionel Sambuc struct boot_image_sys { 16433d6423SLionel Sambuc endpoint_t endpoint; /* process endpoint number */ 17433d6423SLionel Sambuc 18433d6423SLionel Sambuc int flags; /* system flags */ 19433d6423SLionel Sambuc }; 20433d6423SLionel Sambuc 21433d6423SLionel Sambuc /* Definition of an entry of the boot image dev table. */ 22433d6423SLionel Sambuc struct boot_image_dev { 23433d6423SLionel Sambuc endpoint_t endpoint; /* process endpoint number */ 24433d6423SLionel Sambuc 25433d6423SLionel Sambuc dev_t dev_nr; /* major device number */ 26433d6423SLionel Sambuc }; 27433d6423SLionel Sambuc 28fb6bd596SCristiano Giuffrida /* Definition of the update descriptors. */ 29fb6bd596SCristiano Giuffrida struct rproc; 30fb6bd596SCristiano Giuffrida struct rprocupd { 31fb6bd596SCristiano Giuffrida int lu_flags; /* user-specified live update flags */ 32fb6bd596SCristiano Giuffrida int init_flags; /* user-specified init flags */ 33fb6bd596SCristiano Giuffrida int prepare_state; /* the state the process has to prepare for the update */ 34fb6bd596SCristiano Giuffrida endpoint_t state_endpoint; /* the custom process to transfer the state from (if any). */ 35fb6bd596SCristiano Giuffrida clock_t prepare_tm; /* timestamp of when the update was scheduled */ 36fb6bd596SCristiano Giuffrida clock_t prepare_maxtime; /* max time to wait for the process to be ready */ 37fb6bd596SCristiano Giuffrida struct rproc *rp; /* the process under update */ 38fb6bd596SCristiano Giuffrida struct rs_state_data prepare_state_data; /* state data for the update */ 39fb6bd596SCristiano Giuffrida cp_grant_id_t prepare_state_data_gid; /* state data gid */ 40fb6bd596SCristiano Giuffrida struct rprocupd *prev_rpupd; /* the previous process under update */ 41fb6bd596SCristiano Giuffrida struct rprocupd *next_rpupd; /* the next process under update */ 42fb6bd596SCristiano Giuffrida }; 43fb6bd596SCristiano Giuffrida struct rupdate { 44fb6bd596SCristiano Giuffrida int flags; /* flags to keep track of the status of the update */ 45fb6bd596SCristiano Giuffrida int num_rpupds; /* number of descriptors scheduled for the update */ 46fb6bd596SCristiano Giuffrida int num_init_ready_pending; /* number of pending init ready messages */ 47fb6bd596SCristiano Giuffrida struct rprocupd *curr_rpupd; /* the current descriptor under update */ 48fb6bd596SCristiano Giuffrida struct rprocupd *first_rpupd; /* first descriptor scheduled for the update */ 49fb6bd596SCristiano Giuffrida struct rprocupd *last_rpupd; /* last descriptor scheduled for the update */ 50fb6bd596SCristiano Giuffrida struct rprocupd *vm_rpupd; /* VM descriptor scheduled for the update */ 51fb6bd596SCristiano Giuffrida struct rprocupd *rs_rpupd; /* RS descriptor scheduled for the update */ 52fb6bd596SCristiano Giuffrida }; 53fb6bd596SCristiano Giuffrida 54433d6423SLionel Sambuc /* Definition of an entry of the system process table. */ 5550b7f13fSCristiano Giuffrida typedef struct priv ixfer_priv_s; 56433d6423SLionel Sambuc struct rproc { 57433d6423SLionel Sambuc struct rprocpub *r_pub; /* pointer to the corresponding public entry */ 58433d6423SLionel Sambuc struct rproc *r_old_rp; /* pointer to the slot with the old version */ 59433d6423SLionel Sambuc struct rproc *r_new_rp; /* pointer to the slot with the new version */ 60433d6423SLionel Sambuc struct rproc *r_prev_rp; /* pointer to the slot with the prev replica */ 61433d6423SLionel Sambuc struct rproc *r_next_rp; /* pointer to the slot with the next replica */ 62fb6bd596SCristiano Giuffrida struct rprocupd r_upd; /* update descriptor */ 63433d6423SLionel Sambuc pid_t r_pid; /* process id, -1 if the process is not there */ 64433d6423SLionel Sambuc 65*e4d99eb9SDavid van Moolenbroek int r_asr_count; /* number of live updates with ASR */ 66433d6423SLionel Sambuc int r_restarts; /* number of restarts (initially zero) */ 67433d6423SLionel Sambuc long r_backoff; /* number of periods to wait before revive */ 68433d6423SLionel Sambuc unsigned r_flags; /* status and policy flags */ 69fb6bd596SCristiano Giuffrida int r_init_err; /* error code at initialization time */ 70433d6423SLionel Sambuc 71433d6423SLionel Sambuc long r_period; /* heartbeat period (or zero) */ 72433d6423SLionel Sambuc clock_t r_check_tm; /* timestamp of last check */ 73433d6423SLionel Sambuc clock_t r_alive_tm; /* timestamp of last heartbeat */ 74433d6423SLionel Sambuc clock_t r_stop_tm; /* timestamp of SIGTERM signal */ 75433d6423SLionel Sambuc endpoint_t r_caller; /* RS_LATEREPLY caller */ 76433d6423SLionel Sambuc int r_caller_request; /* RS_LATEREPLY caller request */ 77433d6423SLionel Sambuc 78433d6423SLionel Sambuc char r_cmd[MAX_COMMAND_LEN]; /* raw command plus arguments */ 79433d6423SLionel Sambuc char r_args[MAX_COMMAND_LEN]; /* null-separated raw command plus arguments */ 80433d6423SLionel Sambuc #define ARGV_ELEMENTS (MAX_NR_ARGS+2) /* path, args, null */ 81433d6423SLionel Sambuc char *r_argv[ARGV_ELEMENTS]; 82433d6423SLionel Sambuc int r_argc; /* number of arguments */ 83433d6423SLionel Sambuc char r_script[MAX_SCRIPT_LEN]; /* name of the restart script executable */ 84433d6423SLionel Sambuc 85433d6423SLionel Sambuc char *r_exec; /* Executable image */ 86433d6423SLionel Sambuc size_t r_exec_len; /* Length of image */ 87433d6423SLionel Sambuc 8850b7f13fSCristiano Giuffrida ixfer_priv_s r_priv; /* Privilege structure to be passed to the 89433d6423SLionel Sambuc * kernel. 90433d6423SLionel Sambuc */ 91433d6423SLionel Sambuc uid_t r_uid; 92433d6423SLionel Sambuc endpoint_t r_scheduler; /* scheduler */ 93433d6423SLionel Sambuc int r_priority; /* negative values are reserved for special meanings */ 94433d6423SLionel Sambuc int r_quantum; 95433d6423SLionel Sambuc int r_cpu; 96fb6bd596SCristiano Giuffrida vir_bytes r_map_prealloc_addr; /* preallocated mmap address */ 97fb6bd596SCristiano Giuffrida size_t r_map_prealloc_len; /* preallocated mmap len */ 98433d6423SLionel Sambuc 99433d6423SLionel Sambuc /* Backup values from the privilege structure. */ 100433d6423SLionel Sambuc struct io_range r_io_tab[NR_IO_RANGE]; 101433d6423SLionel Sambuc int r_nr_io_range; 102433d6423SLionel Sambuc int r_irq_tab[NR_IRQ]; 103433d6423SLionel Sambuc int r_nr_irq; 104433d6423SLionel Sambuc 105433d6423SLionel Sambuc char r_ipc_list[MAX_IPC_LIST]; 106433d6423SLionel Sambuc int r_nr_control; 107433d6423SLionel Sambuc char r_control[RS_NR_CONTROL][RS_MAX_LABEL_LEN]; 108433d6423SLionel Sambuc }; 109433d6423SLionel Sambuc 110433d6423SLionel Sambuc #endif /* RS_TYPE_H */ 111fb6bd596SCristiano Giuffrida 112fb6bd596SCristiano Giuffrida 113