aboutsummaryrefslogtreecommitdiff
path: root/init
diff options
context:
space:
mode:
authorRon Yorston <rmy@pobox.com>2014-01-02 10:25:11 +0000
committerRon Yorston <rmy@pobox.com>2014-01-02 10:25:11 +0000
commitb8f278ee745778806118f57fb7884d205eba05ad (patch)
treefef237f6dd302c59918cf389a60c120e58d3e086 /init
parent3fd34651ea72ea1c335d3170f234cb0517fd897f (diff)
parent57434022cefde87133b8ad39fb3b79c1274e7684 (diff)
downloadbusybox-w32-b8f278ee745778806118f57fb7884d205eba05ad.tar.gz
busybox-w32-b8f278ee745778806118f57fb7884d205eba05ad.tar.bz2
busybox-w32-b8f278ee745778806118f57fb7884d205eba05ad.zip
Merge branch 'busybox' into merge
Conflicts: archival/Config.src shell/ash.c
Diffstat (limited to 'init')
-rw-r--r--init/bootchartd.c6
-rw-r--r--init/init.c32
2 files changed, 26 insertions, 12 deletions
diff --git a/init/bootchartd.c b/init/bootchartd.c
index 9fd623357..c7388c99e 100644
--- a/init/bootchartd.c
+++ b/init/bootchartd.c
@@ -60,6 +60,12 @@
60# endif 60# endif
61#endif 61#endif
62 62
63#if !ENABLE_TAR && !ENABLE_WERROR
64# warning Note: bootchartd requires tar command, but you did not select it.
65#elif !ENABLE_FEATURE_SEAMLESS_GZ && !ENABLE_WERROR
66# warning Note: bootchartd requires tar -z support, but you did not select it.
67#endif
68
63#define BC_VERSION_STR "0.8" 69#define BC_VERSION_STR "0.8"
64 70
65/* For debugging, set to 0: 71/* For debugging, set to 0:
diff --git a/init/init.c b/init/init.c
index edb5be696..d29328c36 100644
--- a/init/init.c
+++ b/init/init.c
@@ -9,11 +9,6 @@
9 * Licensed under GPLv2 or later, see file LICENSE in this source tree. 9 * Licensed under GPLv2 or later, see file LICENSE in this source tree.
10 */ 10 */
11 11
12//applet:IF_INIT(APPLET(init, BB_DIR_SBIN, BB_SUID_DROP))
13//applet:IF_FEATURE_INITRD(APPLET_ODDNAME(linuxrc, init, BB_DIR_ROOT, BB_SUID_DROP, linuxrc))
14
15//kbuild:lib-$(CONFIG_INIT) += init.o
16
17//config:config INIT 12//config:config INIT
18//config: bool "init" 13//config: bool "init"
19//config: default y 14//config: default y
@@ -108,6 +103,11 @@
108//config: Note that on Linux, init attempts to detect serial terminal and 103//config: Note that on Linux, init attempts to detect serial terminal and
109//config: sets TERM to "vt102" if one is found. 104//config: sets TERM to "vt102" if one is found.
110 105
106//applet:IF_INIT(APPLET(init, BB_DIR_SBIN, BB_SUID_DROP))
107//applet:IF_FEATURE_INITRD(APPLET_ODDNAME(linuxrc, init, BB_DIR_ROOT, BB_SUID_DROP, linuxrc))
108
109//kbuild:lib-$(CONFIG_INIT) += init.o
110
111#define DEBUG_SEGV_HANDLER 0 111#define DEBUG_SEGV_HANDLER 0
112 112
113#include "libbb.h" 113#include "libbb.h"
@@ -222,8 +222,8 @@ static void message(int where, const char *fmt, ...)
222 msg[0] = '\r'; 222 msg[0] = '\r';
223 va_start(arguments, fmt); 223 va_start(arguments, fmt);
224 l = 1 + vsnprintf(msg + 1, sizeof(msg) - 2, fmt, arguments); 224 l = 1 + vsnprintf(msg + 1, sizeof(msg) - 2, fmt, arguments);
225 if (l > sizeof(msg) - 1) 225 if (l > sizeof(msg) - 2)
226 l = sizeof(msg) - 1; 226 l = sizeof(msg) - 2;
227 va_end(arguments); 227 va_end(arguments);
228 228
229#if ENABLE_FEATURE_INIT_SYSLOG 229#if ENABLE_FEATURE_INIT_SYSLOG
@@ -789,7 +789,7 @@ static void run_shutdown_and_kill_processes(void)
789 * and only one will be remembered and acted upon. 789 * and only one will be remembered and acted upon.
790 */ 790 */
791 791
792/* The SIGUSR[12]/SIGTERM handler */ 792/* The SIGPWR/SIGUSR[12]/SIGTERM handler */
793static void halt_reboot_pwoff(int sig) NORETURN; 793static void halt_reboot_pwoff(int sig) NORETURN;
794static void halt_reboot_pwoff(int sig) 794static void halt_reboot_pwoff(int sig)
795{ 795{
@@ -1103,8 +1103,8 @@ int init_main(int argc UNUSED_PARAM, char **argv)
1103 1103
1104 /* NOTE that if CONFIG_FEATURE_USE_INITTAB is NOT defined, 1104 /* NOTE that if CONFIG_FEATURE_USE_INITTAB is NOT defined,
1105 * then parse_inittab() simply adds in some default 1105 * then parse_inittab() simply adds in some default
1106 * actions(i.e., INIT_SCRIPT and a pair 1106 * actions (i.e., INIT_SCRIPT and a pair
1107 * of "askfirst" shells */ 1107 * of "askfirst" shells) */
1108 parse_inittab(); 1108 parse_inittab();
1109 } 1109 }
1110 1110
@@ -1128,13 +1128,14 @@ int init_main(int argc UNUSED_PARAM, char **argv)
1128 strncpy(argv[0], "init", strlen(argv[0])); 1128 strncpy(argv[0], "init", strlen(argv[0]));
1129 /* Wipe argv[1]-argv[N] so they don't clutter the ps listing */ 1129 /* Wipe argv[1]-argv[N] so they don't clutter the ps listing */
1130 while (*++argv) 1130 while (*++argv)
1131 memset(*argv, 0, strlen(*argv)); 1131 nuke_str(*argv);
1132 1132
1133 /* Set up signal handlers */ 1133 /* Set up signal handlers */
1134 if (!DEBUG_INIT) { 1134 if (!DEBUG_INIT) {
1135 struct sigaction sa; 1135 struct sigaction sa;
1136 1136
1137 bb_signals(0 1137 bb_signals(0
1138 + (1 << SIGPWR) /* halt */
1138 + (1 << SIGUSR1) /* halt */ 1139 + (1 << SIGUSR1) /* halt */
1139 + (1 << SIGTERM) /* reboot */ 1140 + (1 << SIGTERM) /* reboot */
1140 + (1 << SIGUSR2) /* poweroff */ 1141 + (1 << SIGUSR2) /* poweroff */
@@ -1230,7 +1231,14 @@ int init_main(int argc UNUSED_PARAM, char **argv)
1230//usage:#define init_trivial_usage 1231//usage:#define init_trivial_usage
1231//usage: "" 1232//usage: ""
1232//usage:#define init_full_usage "\n\n" 1233//usage:#define init_full_usage "\n\n"
1233//usage: "Init is the parent of all processes" 1234//usage: "Init is the first process started during boot. It never exits."
1235//usage: IF_FEATURE_USE_INITTAB(
1236//usage: "\n""It (re)spawns children according to /etc/inittab."
1237//usage: )
1238//usage: IF_NOT_FEATURE_USE_INITTAB(
1239//usage: "\n""This version of init doesn't use /etc/inittab,"
1240//usage: "\n""has fixed set of processed to run."
1241//usage: )
1234//usage: 1242//usage:
1235//usage:#define init_notes_usage 1243//usage:#define init_notes_usage
1236//usage: "This version of init is designed to be run only by the kernel.\n" 1244//usage: "This version of init is designed to be run only by the kernel.\n"