diff options
| author | Rob Landley <rob@landley.net> | 2006-07-09 17:28:17 +0000 |
|---|---|---|
| committer | Rob Landley <rob@landley.net> | 2006-07-09 17:28:17 +0000 |
| commit | cba1b967358c3a552a8d187861284ede98b9fc76 (patch) | |
| tree | 48886db0ab73b8996d88911b8f1068b74a7f5249 | |
| parent | acf448d4f67f997828b72699ae9d56279dbea896 (diff) | |
| download | busybox-w32-cba1b967358c3a552a8d187861284ede98b9fc76.tar.gz busybox-w32-cba1b967358c3a552a8d187861284ede98b9fc76.tar.bz2 busybox-w32-cba1b967358c3a552a8d187861284ede98b9fc76.zip | |
Patch from Shaun Jackman to set environment variable RUNLEVEL equal to
init's argv[1], so if you append "single" to your kernel command line and
the kernel doesn't parse it, RUNLELEL=single.
Plus a few unrelated header cleanups while I was in the area...
| -rw-r--r-- | init/init.c | 22 |
1 files changed, 3 insertions, 19 deletions
diff --git a/init/init.c b/init/init.c index 877b08122..c9200bd6c 100644 --- a/init/init.c +++ b/init/init.c | |||
| @@ -10,35 +10,19 @@ | |||
| 10 | */ | 10 | */ |
| 11 | 11 | ||
| 12 | #include "busybox.h" | 12 | #include "busybox.h" |
| 13 | #include <stdio.h> | ||
| 14 | #include <stdlib.h> | ||
| 15 | #include <errno.h> | 13 | #include <errno.h> |
| 16 | #include <paths.h> | 14 | #include <paths.h> |
| 17 | #include <signal.h> | 15 | #include <signal.h> |
| 18 | #include <stdarg.h> | ||
| 19 | #include <string.h> | ||
| 20 | #include <termios.h> | ||
| 21 | #include <unistd.h> | ||
| 22 | #include <limits.h> | ||
| 23 | #include <fcntl.h> | ||
| 24 | #include <sys/ioctl.h> | 16 | #include <sys/ioctl.h> |
| 25 | #include <sys/types.h> | ||
| 26 | #include <sys/wait.h> | 17 | #include <sys/wait.h> |
| 27 | #include <sys/reboot.h> | 18 | #include <sys/reboot.h> |
| 28 | 19 | ||
| 29 | #include "init_shared.h" | 20 | #include "init_shared.h" |
| 30 | 21 | ||
| 31 | |||
| 32 | #ifdef CONFIG_SYSLOGD | 22 | #ifdef CONFIG_SYSLOGD |
| 33 | # include <sys/syslog.h> | 23 | # include <sys/syslog.h> |
| 34 | #endif | 24 | #endif |
| 35 | 25 | ||
| 36 | |||
| 37 | #ifdef CONFIG_SELINUX | ||
| 38 | # include <selinux/selinux.h> | ||
| 39 | #endif /* CONFIG_SELINUX */ | ||
| 40 | |||
| 41 | |||
| 42 | #define INIT_BUFFS_SIZE 256 | 26 | #define INIT_BUFFS_SIZE 256 |
| 43 | 27 | ||
| 44 | /* From <linux/vt.h> */ | 28 | /* From <linux/vt.h> */ |
| @@ -72,7 +56,6 @@ struct serial_struct { | |||
| 72 | int reserved[1]; | 56 | int reserved[1]; |
| 73 | }; | 57 | }; |
| 74 | 58 | ||
| 75 | |||
| 76 | #ifndef _PATH_STDPATH | 59 | #ifndef _PATH_STDPATH |
| 77 | #define _PATH_STDPATH "/usr/bin:/bin:/usr/sbin:/sbin" | 60 | #define _PATH_STDPATH "/usr/bin:/bin:/usr/sbin:/sbin" |
| 78 | #endif | 61 | #endif |
| @@ -88,8 +71,6 @@ struct serial_struct { | |||
| 88 | #include <sys/resource.h> | 71 | #include <sys/resource.h> |
| 89 | #endif | 72 | #endif |
| 90 | 73 | ||
| 91 | #define KERNEL_VERSION(a,b,c) (((a) << 16) + ((b) << 8) + (c)) | ||
| 92 | |||
| 93 | #define INITTAB "/etc/inittab" /* inittab file location */ | 74 | #define INITTAB "/etc/inittab" /* inittab file location */ |
| 94 | #ifndef INIT_SCRIPT | 75 | #ifndef INIT_SCRIPT |
| 95 | #define INIT_SCRIPT "/etc/init.d/rcS" /* Default sysinit script. */ | 76 | #define INIT_SCRIPT "/etc/init.d/rcS" /* Default sysinit script. */ |
| @@ -1046,6 +1027,9 @@ int init_main(int argc, char **argv) | |||
| 1046 | for(e = environment; *e; e++) | 1027 | for(e = environment; *e; e++) |
| 1047 | putenv((char *) *e); | 1028 | putenv((char *) *e); |
| 1048 | } | 1029 | } |
| 1030 | |||
| 1031 | if (argc > 1) setenv("RUNLEVEL", argv[1], 1); | ||
| 1032 | |||
| 1049 | /* Hello world */ | 1033 | /* Hello world */ |
| 1050 | message(MAYBE_CONSOLE | LOG, "init started: %s", bb_msg_full_version); | 1034 | message(MAYBE_CONSOLE | LOG, "init started: %s", bb_msg_full_version); |
| 1051 | 1035 | ||
