xref: /minix/minix/servers/rs/const.h (revision 7f5f010b)
1 /* Global constants used in RS.
2  */
3 #ifndef RS_CONST_H
4 #define RS_CONST_H
5 
6 #define DEBUG_DEFAULT      0
7 #define PRIV_DEBUG_DEFAULT 0
8 
9 #ifndef DEBUG
10 #define DEBUG DEBUG_DEFAULT
11 #endif
12 
13 #ifndef PRIV_DEBUG
14 #define PRIV_DEBUG PRIV_DEBUG_DEFAULT
15 #endif
16 
17 /* Space reserved for program and arguments. */
18 #define MAX_COMMAND_LEN     512         /* maximum argument string length */
19 #define MAX_SCRIPT_LEN      256         /* maximum restart script name length */
20 #define MAX_NR_ARGS          10         /* maximum number of arguments */
21 
22 #define MAX_IPC_LIST        256         /* Max size of list for IPC target
23                                          * process names
24                                          */
25 
26 /* Flag values. */
27 #define RS_IN_USE       0x001    /* set when process slot is in use */
28 #define RS_EXITING      0x002    /* set when exit is expected */
29 #define RS_REFRESHING   0x004    /* set when refresh must be done */
30 #define RS_NOPINGREPLY  0x008    /* service failed to reply to a ping request */
31 #define RS_TERMINATED   0x010    /* service has terminated */
32 #define RS_LATEREPLY    0x020    /* no reply sent to RS_DOWN caller yet */
33 #define RS_INITIALIZING 0x040    /* set when init is in progress */
34 #define RS_UPDATING     0x080    /* set when update is in progress */
35 #define RS_ACTIVE       0x100    /* set for the active instance of a service */
36 #define RS_REINCARNATE  0x200    /* after exit, restart with a new endpoint */
37 
38 /* Sys flag values. */
39 #define SF_CORE_SRV     0x001    /* set for core system services */
40 #define SF_SYNCH_BOOT   0X002    /* set when process needs synch boot init */
41 #define SF_NEED_COPY    0x004    /* set when process needs copy to start */
42 #define SF_USE_COPY     0x008    /* set when process has a copy in memory */
43 #define SF_NEED_REPL    0x010    /* set when process needs replica to start */
44 #define SF_USE_REPL     0x020    /* set when process has a replica */
45 #define SF_NO_BIN_EXP	0x040    /* set when we should ignore binary exp. offset */
46 #define IMM_SF          \
47     (SF_NO_BIN_EXP | SF_CORE_SRV | SF_SYNCH_BOOT | SF_NEED_COPY | SF_NEED_REPL) /* immutable */
48 
49 /* Constants determining RS period and binary exponential backoff. */
50 #define RS_INIT_T	(system_hz * 10)	/* allow T ticks for init */
51 #define RS_DELTA_T	(system_hz)		/* check every T ticks */
52 #define BACKOFF_BITS    (sizeof(long)*8)        /* bits in backoff field */
53 #define MAX_BACKOFF      30                     /* max backoff in RS_DELTA_T */
54 
55 /* Magic process table addresses. */
56 #define BEG_RPROC_ADDR  (&rproc[0])
57 #define END_RPROC_ADDR  (&rproc[NR_SYS_PROCS])
58 
59 /* Constants for live update. */
60 #define RS_DEFAULT_PREPARE_MAXTIME 2*RS_DELTA_T   /* default prepare max time */
61 #define RS_MAX_PREPARE_MAXTIME     20*RS_DELTA_T  /* max prepare max time */
62 
63 
64 /* Definitions for boot info tables. */
65 #define NULL_BOOT_NR    NR_BOOT_PROCS        /* marks a null boot entry */
66 #define DEFAULT_BOOT_NR NR_BOOT_PROCS        /* marks the default boot entry */
67 
68 /* Define sys flags for the various process types. */
69 #define SRV_SF   (SF_CORE_SRV)                 /* system services */
70 #define SRVR_SF  (SRV_SF | SF_NEED_REPL)       /* services needing a replica */
71 #define DSRV_SF  (0)                           /* dynamic system services */
72 #define VM_SF    (SRVR_SF)     			/* vm */
73 
74 /* Shorthands. */
75 #define SRV_OR_USR(rp, X, Y) (rp->r_priv.s_flags & SYS_PROC ? X : Y)
76 
77 /* Reply flags. */
78 #define RS_DONTREPLY    0
79 #define RS_REPLY        1
80 
81 /* Swap flags. */
82 #define RS_DONTSWAP     0
83 #define RS_SWAP         1
84 
85 #endif /* RS_CONST_H */
86 
87