X-Git-Url: https://git.librecmc.org/?a=blobdiff_plain;f=init%2Finit.c;h=cad64f63ae25f185e5d4a1bf51d515d844ea923c;hb=2aced7ea043aff64bd4e5f2814818fb4d0c803d4;hp=b3d1f6d365bc4d1c1c24d5758a32c86d3b50d261;hpb=cf1f2ace391269655a80e42b692749da0c3d4047;p=oweals%2Fbusybox.git diff --git a/init/init.c b/init/init.c index b3d1f6d36..cad64f63a 100644 --- a/init/init.c +++ b/init/init.c @@ -10,35 +10,19 @@ */ #include "busybox.h" -#include -#include #include #include #include -#include -#include -#include -#include -#include -#include #include -#include #include #include #include "init_shared.h" - #ifdef CONFIG_SYSLOGD # include #endif - -#ifdef CONFIG_SELINUX -# include -#endif /* CONFIG_SELINUX */ - - #define INIT_BUFFS_SIZE 256 /* From */ @@ -72,7 +56,6 @@ struct serial_struct { int reserved[1]; }; - #ifndef _PATH_STDPATH #define _PATH_STDPATH "/usr/bin:/bin:/usr/sbin:/sbin" #endif @@ -88,8 +71,6 @@ struct serial_struct { #include #endif -#define KERNEL_VERSION(a,b,c) (((a) << 16) + ((b) << 8) + (c)) - #define INITTAB "/etc/inittab" /* inittab file location */ #ifndef INIT_SCRIPT #define INIT_SCRIPT "/etc/init.d/rcS" /* Default sysinit script. */ @@ -240,7 +221,7 @@ static void message(int device, const char *fmt, ...) } } if ((device & LOG) && (log_fd >= 0)) { - bb_full_write(log_fd, msg, l); + full_write(log_fd, msg, l); } #endif @@ -249,7 +230,7 @@ static void message(int device, const char *fmt, ...) O_WRONLY | O_NOCTTY | O_NONBLOCK); /* Always send console messages to /dev/console so people will see them. */ if (fd >= 0) { - bb_full_write(fd, msg, l); + full_write(fd, msg, l); close(fd); #if ENABLE_DEBUG_INIT /* all descriptors may be closed */ @@ -312,15 +293,6 @@ static void console_init(void) if ((s = getenv("CONSOLE")) != NULL || (s = getenv("console")) != NULL) { safe_strncpy(console, s, sizeof(console)); -#if 0 /* #cpu(sparc) */ - /* sparc kernel supports console=tty[ab] parameter which is also - * passed to init, so catch it here */ - /* remap tty[ab] to /dev/ttyS[01] */ - if (strcmp(s, "ttya") == 0) - safe_strncpy(console, SC_0, sizeof(console)); - else if (strcmp(s, "ttyb") == 0) - safe_strncpy(console, SC_1, sizeof(console)); -#endif } else { /* 2.2 kernels: identify the real console backend and try to use it */ if (ioctl(0, TIOCGSERIAL, &sr) == 0) { @@ -564,7 +536,7 @@ static pid_t run(const struct init_action *a) messageD(LOG, "Waiting for enter to start '%s'" "(pid %d, terminal %s)\n", cmdpath, getpid(), a->terminal); - bb_full_write(1, press_enter, sizeof(press_enter) - 1); + full_write(1, press_enter, sizeof(press_enter) - 1); while(read(0, &c, 1) == 1 && c != '\n') ; } @@ -842,9 +814,6 @@ static void new_init_action(int action, const char *command, const char *cons) strcpy(new_action->command, command); new_action->action = action; strcpy(new_action->terminal, cons); -#if 0 /* calloc zeroed always */ - new_action->pid = 0; -#endif messageD(LOG|CONSOLE, "command='%s' action='%d' terminal='%s'\n", new_action->command, new_action->action, new_action->terminal); } @@ -1058,6 +1027,9 @@ int init_main(int argc, char **argv) for(e = environment; *e; e++) putenv((char *) *e); } + + if (argc > 1) setenv("RUNLEVEL", argv[1], 1); + /* Hello world */ message(MAYBE_CONSOLE | LOG, "init started: %s", bb_msg_full_version);