[9] | 1 | /* This table has one slot per system process. It contains information for
|
---|
| 2 | * servers and driver needed by the reincarnation server to keep track of
|
---|
| 3 | * each process' status.
|
---|
| 4 | */
|
---|
| 5 |
|
---|
| 6 | /* Space reserved for program and arguments. */
|
---|
| 7 | #define MAX_COMMAND_LEN 512 /* maximum argument string length */
|
---|
| 8 | #define MAX_NR_ARGS 4 /* maximum number of arguments */
|
---|
| 9 | #define MAX_RESCUE_DIR_LEN 64 /* maximum rescue dir length */
|
---|
| 10 |
|
---|
| 11 | /* Definition of the system process table. This table only has entries for
|
---|
| 12 | * the servers and drivers, and thus is not directly indexed by slot number.
|
---|
| 13 | */
|
---|
| 14 | extern struct rproc {
|
---|
| 15 | int r_proc_nr_e; /* process endpoint number */
|
---|
| 16 | pid_t r_pid; /* process id */
|
---|
| 17 | dev_t r_dev_nr; /* major device number */
|
---|
| 18 | int r_dev_style; /* device style */
|
---|
| 19 |
|
---|
| 20 | int r_restarts; /* number of restarts (initially zero) */
|
---|
| 21 | long r_backoff; /* number of periods to wait before revive */
|
---|
| 22 | unsigned r_flags; /* status and policy flags */
|
---|
| 23 |
|
---|
| 24 | long r_period; /* heartbeat period (or zero) */
|
---|
| 25 | clock_t r_check_tm; /* timestamp of last check */
|
---|
| 26 | clock_t r_alive_tm; /* timestamp of last heartbeat */
|
---|
| 27 | clock_t r_stop_tm; /* timestamp of SIGTERM signal */
|
---|
| 28 |
|
---|
| 29 | char r_cmd[MAX_COMMAND_LEN]; /* raw command plus arguments */
|
---|
| 30 | char *r_argv[MAX_NR_ARGS+2]; /* parsed arguments vector */
|
---|
| 31 | int r_argc; /* number of arguments */
|
---|
| 32 | } rproc[NR_SYS_PROCS];
|
---|
| 33 |
|
---|
| 34 | /* Mapping for fast access to the system process table. */
|
---|
| 35 | extern struct rproc *rproc_ptr[NR_PROCS];
|
---|
| 36 | extern int nr_in_use;
|
---|
| 37 |
|
---|
| 38 | /* Flag values. */
|
---|
| 39 | #define RS_IN_USE 0x001 /* set when process slot is in use */
|
---|
| 40 | #define RS_EXITING 0x002 /* set when exit is expected */
|
---|
| 41 | #define RS_REFRESHING 0x004 /* set when refresh must be done */
|
---|
| 42 |
|
---|
| 43 | /* Constants determining RS period and binary exponential backoff. */
|
---|
| 44 | #define RS_DELTA_T 60 /* check every T ticks */
|
---|
| 45 | #define BACKOFF_BITS (sizeof(long)*8) /* bits in backoff field */
|
---|
| 46 | #define MAX_BACKOFF 30 /* max backoff in RS_DELTA_T */
|
---|
| 47 |
|
---|
| 48 | /* Magic process table addresses. */
|
---|
| 49 | #define BEG_RPROC_ADDR (&rproc[0])
|
---|
| 50 | #define END_RPROC_ADDR (&rproc[NR_SYS_PROCS])
|
---|
| 51 | #define NIL_RPROC ((struct mproc *) 0)
|
---|
| 52 |
|
---|