diff options
| author | Erik Andersen <andersen@codepoet.org> | 2000-04-04 18:14:25 +0000 |
|---|---|---|
| committer | Erik Andersen <andersen@codepoet.org> | 2000-04-04 18:14:25 +0000 |
| commit | 983b51b17bb36e5b77cb160abdfbcf9d25675dd9 (patch) | |
| tree | 13642fcca428d88a6a25f768ee45c99e9c13cdc6 /init.c | |
| parent | 3364d78b18386623e7af5da18ba1bb0cc6286279 (diff) | |
| download | busybox-w32-983b51b17bb36e5b77cb160abdfbcf9d25675dd9.tar.gz busybox-w32-983b51b17bb36e5b77cb160abdfbcf9d25675dd9.tar.bz2 busybox-w32-983b51b17bb36e5b77cb160abdfbcf9d25675dd9.zip | |
minor changes to mount/umount to support-by-ignoring the "-v" flag.
Added optional core dumping as a feature for init, and include a rewrite
of syslogd so that it now supports multiple concurrent connections.
-Erik
Diffstat (limited to 'init.c')
| -rw-r--r-- | init.c | 24 |
1 files changed, 22 insertions, 2 deletions
| @@ -45,7 +45,7 @@ | |||
| 45 | #include <sys/reboot.h> | 45 | #include <sys/reboot.h> |
| 46 | #include <sys/sysinfo.h> /* For check_free_memory() */ | 46 | #include <sys/sysinfo.h> /* For check_free_memory() */ |
| 47 | #ifdef BB_SYSLOGD | 47 | #ifdef BB_SYSLOGD |
| 48 | #include <sys/syslog.h> | 48 | # include <sys/syslog.h> |
| 49 | #endif | 49 | #endif |
| 50 | #include <sys/sysmacros.h> | 50 | #include <sys/sysmacros.h> |
| 51 | #include <sys/types.h> | 51 | #include <sys/types.h> |
| @@ -54,6 +54,15 @@ | |||
| 54 | #include <termios.h> | 54 | #include <termios.h> |
| 55 | #include <unistd.h> | 55 | #include <unistd.h> |
| 56 | 56 | ||
| 57 | |||
| 58 | /* | ||
| 59 | * When CORE_ENABLE_FLAG_FILE exists, setrlimit is called before | ||
| 60 | * process is spawned to set corelimit to unlimited. | ||
| 61 | */ | ||
| 62 | #define CORE_ENABLE_FLAG_FILE "/.init_enable_core" | ||
| 63 | #include <sys/resource.h> | ||
| 64 | #include <sys/time.h> | ||
| 65 | |||
| 57 | #ifndef KERNEL_VERSION | 66 | #ifndef KERNEL_VERSION |
| 58 | #define KERNEL_VERSION(a,b,c) (((a) << 16) + ((b) << 8) + (c)) | 67 | #define KERNEL_VERSION(a,b,c) (((a) << 16) + ((b) << 8) + (c)) |
| 59 | #endif | 68 | #endif |
| @@ -406,6 +415,16 @@ static pid_t run(char *command, char *terminal, int get_enter) | |||
| 406 | cmd[i] = NULL; | 415 | cmd[i] = NULL; |
| 407 | } | 416 | } |
| 408 | 417 | ||
| 418 | { | ||
| 419 | struct stat sb; | ||
| 420 | if (stat (CORE_ENABLE_FLAG_FILE, &sb) == 0) { | ||
| 421 | struct rlimit limit; | ||
| 422 | limit.rlim_cur = RLIM_INFINITY; | ||
| 423 | limit.rlim_max = RLIM_INFINITY; | ||
| 424 | setrlimit(RLIMIT_CORE, &limit); | ||
| 425 | } | ||
| 426 | } | ||
| 427 | |||
| 409 | /* Now run it. The new program will take over this PID, | 428 | /* Now run it. The new program will take over this PID, |
| 410 | * so nothing further in init.c should be run. */ | 429 | * so nothing further in init.c should be run. */ |
| 411 | execve(cmd[0], cmd, environment); | 430 | execve(cmd[0], cmd, environment); |
| @@ -836,6 +855,7 @@ extern int init_main(int argc, char **argv) | |||
| 836 | close(1); | 855 | close(1); |
| 837 | close(2); | 856 | close(2); |
| 838 | set_term(0); | 857 | set_term(0); |
| 858 | chdir("/"); | ||
| 839 | setsid(); | 859 | setsid(); |
| 840 | 860 | ||
| 841 | /* Make sure PATH is set to something sane */ | 861 | /* Make sure PATH is set to something sane */ |
| @@ -881,7 +901,7 @@ extern int init_main(int argc, char **argv) | |||
| 881 | * of "askfirst" shells */ | 901 | * of "askfirst" shells */ |
| 882 | parse_inittab(); | 902 | parse_inittab(); |
| 883 | } | 903 | } |
| 884 | 904 | ||
| 885 | /* Fix up argv[0] to be certain we claim to be init */ | 905 | /* Fix up argv[0] to be certain we claim to be init */ |
| 886 | strncpy(argv[0], "init", strlen(argv[0])+1); | 906 | strncpy(argv[0], "init", strlen(argv[0])+1); |
| 887 | if (argc > 1) | 907 | if (argc > 1) |
