]>
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 # define INITDBG(level, fmt, args...) initlog(level, fmt, ##args)
59 # define INITDBG(level, fmt, args...)
62 /* Actions to be taken by init */
74 #define INITDEFAULT 12
76 #define POWERFAILNOW 14
79 /* Information about a process in the in-core inittab */
80 typedef struct _child_
{
81 int flags
; /* Status of this entry */
82 int exstat
; /* Exit status of process */
83 int pid
; /* Pid of this process */
84 time_t tm
; /* When respawned last */
85 int count
; /* Times respawned in the last 2 minutes */
86 char id
[8]; /* Inittab id (must be unique) */
87 char rlevel
[12]; /* run levels */
88 int action
; /* what to do (see list below) */
89 char process
[128]; /* The command line */
90 struct _child_
*new; /* New entry (after inittab re-read) */
91 struct _child_
*next
; /* For the linked list */
94 /* Values for the 'flags' field */
95 #define RUNNING 2 /* Process is still running */
96 #define KILLME 4 /* Kill this process */
97 #define DEMAND 8 /* "runlevels" a b c */
98 #define FAILING 16 /* process respawns rapidly */
99 #define WAITING 32 /* We're waiting for this process */
100 #define ZOMBIE 64 /* This process is already dead */
101 #define XECUTED 128 /* Set if spawned once or more times */
104 #define L_CO 1 /* Log on the console. */
105 #define L_SY 2 /* Log with syslog() */
106 #define L_VB (L_CO|L_SY) /* Log with both. */
109 # define NO_PROCESS 0
115 extern CHILD
*family
;
116 extern int wrote_wtmp_reboot
;
117 extern int wrote_utmp_reboot
;
119 /* Tokens in state parser */
131 #define D_RUNLEVEL -2
132 #define D_THISLEVEL -3
133 #define D_PREVLEVEL -4
135 #define D_WROTE_WTMP_REBOOT -6
136 #define D_WROTE_UTMP_REBOOT -7