diff options
| author | Eric Andersen <andersen@codepoet.org> | 2001-10-24 05:00:29 +0000 |
|---|---|---|
| committer | Eric Andersen <andersen@codepoet.org> | 2001-10-24 05:00:29 +0000 |
| commit | bdfd0d78bc44e73d693510e70087857785b3b521 (patch) | |
| tree | 153a573095afac8d8d0ea857759ecabd77fb28b7 /init | |
| parent | 9260fc5552a3ee52eb95823aa6689d52a1ffd33c (diff) | |
| download | busybox-w32-bdfd0d78bc44e73d693510e70087857785b3b521.tar.gz busybox-w32-bdfd0d78bc44e73d693510e70087857785b3b521.tar.bz2 busybox-w32-bdfd0d78bc44e73d693510e70087857785b3b521.zip | |
Major rework of the directory structure and the entire build system.
-Erik
Diffstat (limited to 'init')
| -rw-r--r-- | init/Makefile | 39 | ||||
| -rw-r--r-- | init/config.in | 25 | ||||
| -rw-r--r-- | init/halt.c | 2 | ||||
| -rw-r--r-- | init/init.c | 32 | ||||
| -rw-r--r-- | init/poweroff.c | 2 | ||||
| -rw-r--r-- | init/reboot.c | 2 |
6 files changed, 83 insertions, 19 deletions
diff --git a/init/Makefile b/init/Makefile new file mode 100644 index 000000000..472fb02b1 --- /dev/null +++ b/init/Makefile | |||
| @@ -0,0 +1,39 @@ | |||
| 1 | # Makefile for busybox | ||
| 2 | # | ||
| 3 | # Copyright (C) 1999,2000,2001 by Erik Andersen <andersee@debian.org> | ||
| 4 | # | ||
| 5 | # This program is free software; you can redistribute it and/or modify | ||
| 6 | # it under the terms of the GNU General Public License as published by | ||
| 7 | # the Free Software Foundation; either version 2 of the License, or | ||
| 8 | # (at your option) any later version. | ||
| 9 | # | ||
| 10 | # This program is distributed in the hope that it will be useful, | ||
| 11 | # but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
| 12 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU | ||
| 13 | # General Public License for more details. | ||
| 14 | # | ||
| 15 | # You should have received a copy of the GNU General Public License | ||
| 16 | # along with this program; if not, write to the Free Software | ||
| 17 | # Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA | ||
| 18 | # | ||
| 19 | |||
| 20 | TOPDIR :=.. | ||
| 21 | L_TARGET := init.a | ||
| 22 | |||
| 23 | obj-y := | ||
| 24 | obj-n := | ||
| 25 | obj- := | ||
| 26 | |||
| 27 | obj-$(CONFIG_HALT) += halt.o | ||
| 28 | obj-$(CONFIG_INIT) += init.o | ||
| 29 | obj-$(CONFIG_POWEROFF) += poweroff.o | ||
| 30 | obj-$(CONFIG_REBOOT) += reboot.o | ||
| 31 | obj-$(CONFIG_START_STOP_DAEMON) += start_stop_daemon.o | ||
| 32 | |||
| 33 | |||
| 34 | # Hand off to toplevel Rules.mak | ||
| 35 | include $(TOPDIR)/Rules.mak | ||
| 36 | |||
| 37 | clean: | ||
| 38 | rm -f $(L_TARGET) *.o core | ||
| 39 | |||
diff --git a/init/config.in b/init/config.in new file mode 100644 index 000000000..1d4760c2c --- /dev/null +++ b/init/config.in | |||
| @@ -0,0 +1,25 @@ | |||
| 1 | # | ||
| 2 | # For a description of the syntax of this configuration file, | ||
| 3 | # see scripts/kbuild/config-language.txt. | ||
| 4 | # | ||
| 5 | |||
| 6 | mainmenu_option next_comment | ||
| 7 | comment 'Init Utilities' | ||
| 8 | |||
| 9 | |||
| 10 | bool 'init' CONFIG_INIT | ||
| 11 | if [ "$CONFIG_INIT" = "y" ]; then | ||
| 12 | bool ' Support reading an inittab file?' CONFIG_FEATURE_USE_INITTAB | ||
| 13 | bool ' Support running init from within an initrd?' CONFIG_FEATURE_INITRD | ||
| 14 | bool ' Support dumping core for child processes (debugging only)?' CONFIG_FEATURE_INIT_COREDUMPS | ||
| 15 | bool ' Should init be _extra_ quiet on boot?' CONFIG_FEATURE_EXTRA_QUIET | ||
| 16 | |||
| 17 | # Some more apps that are meaningless without BusyBox running as init | ||
| 18 | bool 'halt' CONFIG_HALT | ||
| 19 | bool 'poweroff' CONFIG_POWEROFF | ||
| 20 | bool 'reboot' CONFIG_REBOOT | ||
| 21 | bool 'start-stop-daemon' CONFIG_START_STOP_DAEMON | ||
| 22 | fi | ||
| 23 | |||
| 24 | endmenu | ||
| 25 | |||
diff --git a/init/halt.c b/init/halt.c index d66e28d0e..307c1022d 100644 --- a/init/halt.c +++ b/init/halt.c | |||
| @@ -26,7 +26,7 @@ | |||
| 26 | 26 | ||
| 27 | extern int halt_main(int argc, char **argv) | 27 | extern int halt_main(int argc, char **argv) |
| 28 | { | 28 | { |
| 29 | #ifdef BB_FEATURE_LINUXRC | 29 | #ifdef CONFIG_FEATURE_INITRD |
| 30 | /* don't assume init's pid == 1 */ | 30 | /* don't assume init's pid == 1 */ |
| 31 | pid_t *pid = find_pid_by_name("init"); | 31 | pid_t *pid = find_pid_by_name("init"); |
| 32 | if (!pid || *pid<=0) { | 32 | if (!pid || *pid<=0) { |
diff --git a/init/init.c b/init/init.c index 068e1df16..b6eaa46ea 100644 --- a/init/init.c +++ b/init/init.c | |||
| @@ -43,7 +43,7 @@ | |||
| 43 | #include <sys/types.h> | 43 | #include <sys/types.h> |
| 44 | #include <sys/wait.h> | 44 | #include <sys/wait.h> |
| 45 | #include "busybox.h" | 45 | #include "busybox.h" |
| 46 | #ifdef BB_SYSLOGD | 46 | #ifdef CONFIG_SYSLOGD |
| 47 | # include <sys/syslog.h> | 47 | # include <sys/syslog.h> |
| 48 | #endif | 48 | #endif |
| 49 | 49 | ||
| @@ -96,7 +96,7 @@ static const int RB_AUTOBOOT = 0x01234567; | |||
| 96 | #endif | 96 | #endif |
| 97 | 97 | ||
| 98 | 98 | ||
| 99 | #if defined BB_FEATURE_INIT_COREDUMPS | 99 | #if defined CONFIG_FEATURE_INIT_COREDUMPS |
| 100 | /* | 100 | /* |
| 101 | * When a file named CORE_ENABLE_FLAG_FILE exists, setrlimit is called | 101 | * When a file named CORE_ENABLE_FLAG_FILE exists, setrlimit is called |
| 102 | * before processes are spawned to set core file size as unlimited. | 102 | * before processes are spawned to set core file size as unlimited. |
| @@ -194,7 +194,7 @@ static void message(int device, char *fmt, ...) | |||
| 194 | va_list arguments; | 194 | va_list arguments; |
| 195 | int fd; | 195 | int fd; |
| 196 | 196 | ||
| 197 | #ifdef BB_SYSLOGD | 197 | #ifdef CONFIG_SYSLOGD |
| 198 | 198 | ||
| 199 | /* Log the message to syslogd */ | 199 | /* Log the message to syslogd */ |
| 200 | if (device & LOG) { | 200 | if (device & LOG) { |
| @@ -546,7 +546,7 @@ static pid_t run(char *command, char *terminal, int get_enter) | |||
| 546 | getpid(), terminal, command); | 546 | getpid(), terminal, command); |
| 547 | #endif | 547 | #endif |
| 548 | 548 | ||
| 549 | #if defined BB_FEATURE_INIT_COREDUMPS | 549 | #if defined CONFIG_FEATURE_INIT_COREDUMPS |
| 550 | if (stat (CORE_ENABLE_FLAG_FILE, &sb) == 0) { | 550 | if (stat (CORE_ENABLE_FLAG_FILE, &sb) == 0) { |
| 551 | struct rlimit limit; | 551 | struct rlimit limit; |
| 552 | limit.rlim_cur = RLIM_INFINITY; | 552 | limit.rlim_cur = RLIM_INFINITY; |
| @@ -701,7 +701,7 @@ static void ctrlaltdel_signal(int sig) | |||
| 701 | static void new_initAction(initActionEnum action, char *process, char *cons) | 701 | static void new_initAction(initActionEnum action, char *process, char *cons) |
| 702 | { | 702 | { |
| 703 | initAction *newAction; | 703 | initAction *newAction; |
| 704 | #ifdef BB_FEATURE_INIT_NORMAL_ORDER | 704 | #ifdef CONFIG_FEATURE_INIT_NORMAL_ORDER |
| 705 | initAction *a; | 705 | initAction *a; |
| 706 | #endif | 706 | #endif |
| 707 | 707 | ||
| @@ -723,7 +723,7 @@ static void new_initAction(initActionEnum action, char *process, char *cons) | |||
| 723 | message(LOG | CONSOLE, "Memory allocation failure\n"); | 723 | message(LOG | CONSOLE, "Memory allocation failure\n"); |
| 724 | loop_forever(); | 724 | loop_forever(); |
| 725 | } | 725 | } |
| 726 | #ifdef BB_FEATURE_INIT_NORMAL_ORDER | 726 | #ifdef CONFIG_FEATURE_INIT_NORMAL_ORDER |
| 727 | for (a = initActionList; a && a->nextPtr; a = a->nextPtr) ; | 727 | for (a = initActionList; a && a->nextPtr; a = a->nextPtr) ; |
| 728 | if (a) { | 728 | if (a) { |
| 729 | a->nextPtr = newAction; | 729 | a->nextPtr = newAction; |
| @@ -759,16 +759,16 @@ static void delete_initAction(initAction * action) | |||
| 759 | } | 759 | } |
| 760 | } | 760 | } |
| 761 | 761 | ||
| 762 | /* NOTE that if BB_FEATURE_USE_INITTAB is NOT defined, | 762 | /* NOTE that if CONFIG_FEATURE_USE_INITTAB is NOT defined, |
| 763 | * then parse_inittab() simply adds in some default | 763 | * then parse_inittab() simply adds in some default |
| 764 | * actions(i.e., runs INIT_SCRIPT and then starts a pair | 764 | * actions(i.e., runs INIT_SCRIPT and then starts a pair |
| 765 | * of "askfirst" shells). If BB_FEATURE_USE_INITTAB | 765 | * of "askfirst" shells). If CONFIG_FEATURE_USE_INITTAB |
| 766 | * _is_ defined, but /etc/inittab is missing, this | 766 | * _is_ defined, but /etc/inittab is missing, this |
| 767 | * results in the same set of default behaviors. | 767 | * results in the same set of default behaviors. |
| 768 | * */ | 768 | * */ |
| 769 | static void parse_inittab(void) | 769 | static void parse_inittab(void) |
| 770 | { | 770 | { |
| 771 | #ifdef BB_FEATURE_USE_INITTAB | 771 | #ifdef CONFIG_FEATURE_USE_INITTAB |
| 772 | FILE *file; | 772 | FILE *file; |
| 773 | char buf[256], lineAsRead[256], tmpConsole[256]; | 773 | char buf[256], lineAsRead[256], tmpConsole[256]; |
| 774 | char *id, *runlev, *action, *process, *eol; | 774 | char *id, *runlev, *action, *process, *eol; |
| @@ -782,7 +782,7 @@ static void parse_inittab(void) | |||
| 782 | #endif | 782 | #endif |
| 783 | /* Reboot on Ctrl-Alt-Del */ | 783 | /* Reboot on Ctrl-Alt-Del */ |
| 784 | new_initAction(CTRLALTDEL, "/sbin/reboot", console); | 784 | new_initAction(CTRLALTDEL, "/sbin/reboot", console); |
| 785 | #ifdef BB_FEATURE_INIT_NORMAL_ORDER | 785 | #ifdef CONFIG_FEATURE_INIT_NORMAL_ORDER |
| 786 | /* Umount all filesystems on halt/reboot */ | 786 | /* Umount all filesystems on halt/reboot */ |
| 787 | new_initAction(SHUTDOWN, "/bin/umount -a -r", console); | 787 | new_initAction(SHUTDOWN, "/bin/umount -a -r", console); |
| 788 | /* Swapoff on halt/reboot */ | 788 | /* Swapoff on halt/reboot */ |
| @@ -808,7 +808,7 @@ static void parse_inittab(void) | |||
| 808 | new_initAction(SYSINIT, INIT_SCRIPT, console); | 808 | new_initAction(SYSINIT, INIT_SCRIPT, console); |
| 809 | 809 | ||
| 810 | return; | 810 | return; |
| 811 | #ifdef BB_FEATURE_USE_INITTAB | 811 | #ifdef CONFIG_FEATURE_USE_INITTAB |
| 812 | } | 812 | } |
| 813 | 813 | ||
| 814 | while (fgets(buf, 255, file) != NULL) { | 814 | while (fgets(buf, 255, file) != NULL) { |
| @@ -880,7 +880,7 @@ static void parse_inittab(void) | |||
| 880 | } | 880 | } |
| 881 | } | 881 | } |
| 882 | return; | 882 | return; |
| 883 | #endif /* BB_FEATURE_USE_INITTAB */ | 883 | #endif /* CONFIG_FEATURE_USE_INITTAB */ |
| 884 | } | 884 | } |
| 885 | 885 | ||
| 886 | 886 | ||
| @@ -894,7 +894,7 @@ extern int init_main(int argc, char **argv) | |||
| 894 | #ifndef DEBUG_INIT | 894 | #ifndef DEBUG_INIT |
| 895 | /* Expect to be invoked as init with PID=1 or be invoked as linuxrc */ | 895 | /* Expect to be invoked as init with PID=1 or be invoked as linuxrc */ |
| 896 | if (getpid() != 1 | 896 | if (getpid() != 1 |
| 897 | #ifdef BB_FEATURE_LINUXRC | 897 | #ifdef CONFIG_FEATURE_INITRD |
| 898 | && strstr(applet_name, "linuxrc") == NULL | 898 | && strstr(applet_name, "linuxrc") == NULL |
| 899 | #endif | 899 | #endif |
| 900 | ) | 900 | ) |
| @@ -933,14 +933,14 @@ extern int init_main(int argc, char **argv) | |||
| 933 | /* Hello world */ | 933 | /* Hello world */ |
| 934 | #ifndef DEBUG_INIT | 934 | #ifndef DEBUG_INIT |
| 935 | message( | 935 | message( |
| 936 | #if ! defined BB_FEATURE_EXTRA_QUIET | 936 | #if ! defined CONFIG_FEATURE_EXTRA_QUIET |
| 937 | CONSOLE| | 937 | CONSOLE| |
| 938 | #endif | 938 | #endif |
| 939 | LOG, | 939 | LOG, |
| 940 | "init started: %s\r\n", full_version); | 940 | "init started: %s\r\n", full_version); |
| 941 | #else | 941 | #else |
| 942 | message( | 942 | message( |
| 943 | #if ! defined BB_FEATURE_EXTRA_QUIET | 943 | #if ! defined CONFIG_FEATURE_EXTRA_QUIET |
| 944 | CONSOLE| | 944 | CONSOLE| |
| 945 | #endif | 945 | #endif |
| 946 | LOG, | 946 | LOG, |
| @@ -966,7 +966,7 @@ extern int init_main(int argc, char **argv) | |||
| 966 | } else { | 966 | } else { |
| 967 | /* Not in single user mode -- see what inittab says */ | 967 | /* Not in single user mode -- see what inittab says */ |
| 968 | 968 | ||
| 969 | /* NOTE that if BB_FEATURE_USE_INITTAB is NOT defined, | 969 | /* NOTE that if CONFIG_FEATURE_USE_INITTAB is NOT defined, |
| 970 | * then parse_inittab() simply adds in some default | 970 | * then parse_inittab() simply adds in some default |
| 971 | * actions(i.e., runs INIT_SCRIPT and then starts a pair | 971 | * actions(i.e., runs INIT_SCRIPT and then starts a pair |
| 972 | * of "askfirst" shells */ | 972 | * of "askfirst" shells */ |
diff --git a/init/poweroff.c b/init/poweroff.c index db20a4572..cec2d6ddd 100644 --- a/init/poweroff.c +++ b/init/poweroff.c | |||
| @@ -26,7 +26,7 @@ | |||
| 26 | 26 | ||
| 27 | extern int poweroff_main(int argc, char **argv) | 27 | extern int poweroff_main(int argc, char **argv) |
| 28 | { | 28 | { |
| 29 | #ifdef BB_FEATURE_LINUXRC | 29 | #ifdef CONFIG_FEATURE_INITRD |
| 30 | /* don't assume init's pid == 1 */ | 30 | /* don't assume init's pid == 1 */ |
| 31 | pid_t *pid = find_pid_by_name("init"); | 31 | pid_t *pid = find_pid_by_name("init"); |
| 32 | if (!pid || *pid<=0) { | 32 | if (!pid || *pid<=0) { |
diff --git a/init/reboot.c b/init/reboot.c index 35afd74ff..a13d42492 100644 --- a/init/reboot.c +++ b/init/reboot.c | |||
| @@ -26,7 +26,7 @@ | |||
| 26 | 26 | ||
| 27 | extern int reboot_main(int argc, char **argv) | 27 | extern int reboot_main(int argc, char **argv) |
| 28 | { | 28 | { |
| 29 | #ifdef BB_FEATURE_LINUXRC | 29 | #ifdef CONFIG_FEATURE_INITRD |
| 30 | /* don't assume init's pid == 1 */ | 30 | /* don't assume init's pid == 1 */ |
| 31 | pid_t *pid = find_pid_by_name("init"); | 31 | pid_t *pid = find_pid_by_name("init"); |
| 32 | if (!pid || *pid<=0) { | 32 | if (!pid || *pid<=0) { |
