Commit | Line | Data |
---|---|---|
800ffe89 NW |
1 | /* |
2 | * Defaults | |
3 | */ | |
4 | #define RETRYTIME 5*60 | |
5 | #define INIT_M2S_TERMTO 10 | |
6 | #define INIT_M2S_KILLTO 30 | |
7 | #define DEF_CHECKTIME 5 | |
8 | #define DEF_CHECKSTATUS 1 | |
9 | #define ALLOC_ARGV 4 | |
10 | #define CALLOUT_MINFREE 5 | |
11 | #define CALLOUT_CHUNK 10 | |
12 | ||
13 | ||
14 | #ifndef TESTRUN | |
15 | # define DEBUG_LEVEL 0 | |
16 | # define INIT_CONFIG "/etc/init.conf" | |
17 | #else /* TESTRUN */ | |
18 | # define DEBUG_LEVEL 5 | |
19 | # define INIT_CONFIG "./init.conf" | |
20 | #endif /* TESTRUN */ | |
21 | ||
22 | ||
9a6eb889 | 23 | #ifdef DEBUG |
800ffe89 | 24 | extern int debug; |
9a6eb889 | 25 | #endif |
800ffe89 NW |
26 | extern int retrytime; |
27 | extern char **ienviron; | |
28 | extern sigset_t block_set; | |
29 | ||
30 | ||
31 | #define blocksig() sigprocmask(SIG_BLOCK, &block_set, 0) | |
32 | #define unblocksig() sigprocmask(SIG_UNBLOCK, &block_set, 0) | |
33 | ||
34 | ||
35 | ||
36 | /* internal representation of getty table */ | |
37 | typedef struct ttytab { | |
38 | struct ttytab *next; | |
39 | struct ttytab *prev; | |
40 | char *name; /* device name */ | |
41 | char **argv; /* argv for execve() */ | |
42 | char *type; /* terminal type */ | |
43 | int intflags; /* internal flags, see below */ | |
44 | pid_t pid; /* PID of spawned process */ | |
45 | int failcount; /* how often getty exited with error */ | |
46 | time_t starttime; /* when it was started */ | |
47 | } ttytab_t; | |
48 | ||
49 | ||
50 | /* Values for intflags: */ | |
51 | #define INIT_SEEN 0x001 | |
52 | #define INIT_CHANGED 0x002 | |
53 | #define INIT_NEW 0x004 | |
54 | #define INIT_FAILED 0x008 /* process exited with error code last time */ | |
55 | #define INIT_OPEN 0x010 /* Init has to do the open() */ | |
56 | #define INIT_NODEV 0x020 /* do not append device to argv */ | |
57 | #define INIT_DONTSPAWN 0x040 /* do not respawn a process on this line */ | |
58 | #define INIT_ARG0 0x080 /* don't pass command as argv[0] */ | |
59 | #define INIT_FAILSLEEP 0x100 /* getty is asleep before it is retried */ | |
60 | ||
61 | ||
62 | /* type field for callout table */ | |
63 | typedef enum { | |
64 | CO_ENT2TAB, /* retry multiuser() */ | |
65 | CO_FORK, /* retry do_getty(tt) */ | |
66 | CO_GETTY, /* retry do_getty(tt) */ | |
67 | CO_MUL2SIN, /* timeout in multi2single */ | |
68 | } retr_t; | |
69 | ||
70 | /* format of callout table */ | |
71 | typedef struct callout { | |
72 | struct callout *next; | |
73 | unsigned int sleept; | |
74 | retr_t what; | |
75 | void *arg; | |
76 | } callout_t; |