]>
git.wh0rd.org - sysvinit.git/blob - src/init.h
2 * init.h Several defines and declarations to be
3 * included by all modules of the init program.
5 * Version: @(#)init.h 2.85-5 02-Jul-2003 miquels@cistron.nl
7 * Copyright (C) 1998-2003 Miquel van Smoorenburg.
9 * This program is free software; you can redistribute it and/or modify
10 * it under the terms of the GNU General Public License as published by
11 * the Free Software Foundation; either version 2 of the License, or
12 * (at your option) any later version.
14 * This program is distributed in the hope that it will be useful,
15 * but WITHOUT ANY WARRANTY; without even the implied warranty of
16 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
17 * GNU General Public License for more details.
19 * You should have received a copy of the GNU General Public License
20 * along with this program; if not, write to the Free Software
21 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
25 /* Standard configuration */
26 #define CHANGE_WAIT 0 /* Change runlevel while
27 waiting for a process to exit? */
28 /* Debug and test modes */
29 #define DEBUG 0 /* Debug code off */
30 #define INITDEBUG 0 /* Fork at startup to debug init. */
33 #define INITPID 1 /* pid of first process */
34 #define PIPE_FD 10 /* Fileno of initfifo. */
35 #define STATE_PIPE 11 /* used to pass state through exec */
37 /* Failsafe configuration */
38 #define MAXSPAWN 10 /* Max times respawned in.. */
39 #define TESTTIME 120 /* this much seconds */
40 #define SLEEPTIME 300 /* Disable time */
42 /* Default path inherited by every child. */
43 #define PATH_DEFAULT "/sbin:/usr/sbin:/bin:/usr/bin"
47 void write_utmp_wtmp(char *user
, char *id
, int pid
, int type
, char *line
);
48 void write_wtmp(char *user
, char *id
, int pid
, int type
, char *line
);
50 __attribute__ ((format (printf
, 2, 3)))
52 void initlog(int loglevel
, char *fmt
, ...);
53 void set_term(int how
);
54 void print(char *fmt
);
57 void wall(const char *text
, int remote
);
60 # define INITDBG(level, fmt, args...) initlog(level, fmt, ##args)
62 # define INITDBG(level, fmt, args...)
65 /* Actions to be taken by init */
77 #define INITDEFAULT 12
79 #define POWERFAILNOW 14
82 /* Information about a process in the in-core inittab */
83 typedef struct _child_
{
84 int flags
; /* Status of this entry */
85 int exstat
; /* Exit status of process */
86 int pid
; /* Pid of this process */
87 time_t tm
; /* When respawned last */
88 int count
; /* Times respawned in the last 2 minutes */
89 char id
[8]; /* Inittab id (must be unique) */
90 char rlevel
[12]; /* run levels */
91 int action
; /* what to do (see list below) */
92 char process
[128]; /* The command line */
93 struct _child_
*new; /* New entry (after inittab re-read) */
94 struct _child_
*next
; /* For the linked list */
97 /* Values for the 'flags' field */
98 #define RUNNING 2 /* Process is still running */
99 #define KILLME 4 /* Kill this process */
100 #define DEMAND 8 /* "runlevels" a b c */
101 #define FAILING 16 /* process respawns rapidly */
102 #define WAITING 32 /* We're waiting for this process */
103 #define ZOMBIE 64 /* This process is already dead */
104 #define XECUTED 128 /* Set if spawned once or more times */
107 #define L_CO 1 /* Log on the console. */
108 #define L_SY 2 /* Log with syslog() */
109 #define L_VB (L_CO|L_SY) /* Log with both. */
112 # define NO_PROCESS 0
118 extern CHILD
*family
;
119 extern int wrote_wtmp_reboot
;
120 extern int wrote_utmp_reboot
;
121 extern int wrote_wtmp_rlevel
;
122 extern int wrote_utmp_rlevel
;
123 extern char thislevel
;
124 extern char prevlevel
;
126 /* Tokens in state parser */
138 #define D_RUNLEVEL -2
139 #define D_THISLEVEL -3
140 #define D_PREVLEVEL -4
142 #define D_WROTE_WTMP_REBOOT -6
143 #define D_WROTE_UTMP_REBOOT -7
146 #define D_WROTE_WTMP_RLEVEL -16
147 #define D_WROTE_UTMP_RLEVEL -17