mirror of
https://github.com/sheumann/hush.git
synced 2024-12-26 10:32:02 +00:00
- DEBUG_INIT -> config CONFIG_DEBUG_INIT
This commit is contained in:
parent
76bb97c995
commit
35e1a077d6
@ -11,6 +11,14 @@ config CONFIG_INIT
|
|||||||
help
|
help
|
||||||
init is the first program run when the system boots.
|
init is the first program run when the system boots.
|
||||||
|
|
||||||
|
config CONFIG_DEBUG_INIT
|
||||||
|
bool "debugging aid"
|
||||||
|
default n
|
||||||
|
depends on CONFIG_INIT
|
||||||
|
help
|
||||||
|
Turn this on to disable all the dangerous
|
||||||
|
rebooting stuff when debugging.
|
||||||
|
|
||||||
config CONFIG_FEATURE_USE_INITTAB
|
config CONFIG_FEATURE_USE_INITTAB
|
||||||
bool "Support reading an inittab file"
|
bool "Support reading an inittab file"
|
||||||
default y
|
default y
|
||||||
|
19
init/init.c
19
init/init.c
@ -9,11 +9,6 @@
|
|||||||
* Licensed under GPLv2 or later, see file LICENSE in this tarball for details.
|
* Licensed under GPLv2 or later, see file LICENSE in this tarball for details.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
/* Turn this on to disable all the dangerous
|
|
||||||
rebooting stuff when debugging.
|
|
||||||
#define DEBUG_INIT
|
|
||||||
*/
|
|
||||||
|
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
#include <errno.h>
|
#include <errno.h>
|
||||||
@ -191,13 +186,13 @@ static void loop_forever(void)
|
|||||||
|
|
||||||
/* Print a message to the specified device.
|
/* Print a message to the specified device.
|
||||||
* Device may be bitwise-or'd from LOG | CONSOLE */
|
* Device may be bitwise-or'd from LOG | CONSOLE */
|
||||||
#ifndef DEBUG_INIT
|
#if ENABLE_DEBUG_INIT
|
||||||
|
#define messageD message
|
||||||
|
#else
|
||||||
static inline void messageD(int ATTRIBUTE_UNUSED device,
|
static inline void messageD(int ATTRIBUTE_UNUSED device,
|
||||||
const char ATTRIBUTE_UNUSED *fmt, ...)
|
const char ATTRIBUTE_UNUSED *fmt, ...)
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
#else
|
|
||||||
#define messageD message
|
|
||||||
#endif
|
#endif
|
||||||
static void message(int device, const char *fmt, ...)
|
static void message(int device, const char *fmt, ...)
|
||||||
__attribute__ ((format(printf, 2, 3)));
|
__attribute__ ((format(printf, 2, 3)));
|
||||||
@ -253,7 +248,7 @@ static void message(int device, const char *fmt, ...)
|
|||||||
if (fd >= 0) {
|
if (fd >= 0) {
|
||||||
bb_full_write(fd, msg, l);
|
bb_full_write(fd, msg, l);
|
||||||
close(fd);
|
close(fd);
|
||||||
#ifdef DEBUG_INIT
|
#if ENABLE_DEBUG_INIT
|
||||||
/* all descriptors may be closed */
|
/* all descriptors may be closed */
|
||||||
} else {
|
} else {
|
||||||
bb_error_msg("Bummer, can't print: ");
|
bb_error_msg("Bummer, can't print: ");
|
||||||
@ -655,7 +650,7 @@ static void run_actions(int action)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
#ifndef DEBUG_INIT
|
#if !ENABLE_DEBUG_INIT
|
||||||
static void init_reboot(unsigned long magic)
|
static void init_reboot(unsigned long magic)
|
||||||
{
|
{
|
||||||
pid_t pid;
|
pid_t pid;
|
||||||
@ -816,7 +811,7 @@ static void cont_handler(int sig ATTRIBUTE_UNUSED)
|
|||||||
got_cont = 1;
|
got_cont = 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
#endif /* ! DEBUG_INIT */
|
#endif /* ! ENABLE_DEBUG_INIT */
|
||||||
|
|
||||||
static void new_init_action(int action, const char *command, const char *cons)
|
static void new_init_action(int action, const char *command, const char *cons)
|
||||||
{
|
{
|
||||||
@ -1026,7 +1021,7 @@ int init_main(int argc, char **argv)
|
|||||||
if (argc > 1 && !strcmp(argv[1], "-q")) {
|
if (argc > 1 && !strcmp(argv[1], "-q")) {
|
||||||
return kill(1,SIGHUP);
|
return kill(1,SIGHUP);
|
||||||
}
|
}
|
||||||
#ifndef DEBUG_INIT
|
#if !ENABLE_DEBUG_INIT
|
||||||
/* Expect to be invoked as init with PID=1 or be invoked as linuxrc */
|
/* Expect to be invoked as init with PID=1 or be invoked as linuxrc */
|
||||||
if (getpid() != 1 &&
|
if (getpid() != 1 &&
|
||||||
(!ENABLE_FEATURE_INITRD || !strstr(bb_applet_name, "linuxrc")))
|
(!ENABLE_FEATURE_INITRD || !strstr(bb_applet_name, "linuxrc")))
|
||||||
|
Loading…
Reference in New Issue
Block a user