aboutsummaryrefslogtreecommitdiff
path: root/init
diff options
context:
space:
mode:
authorErik Andersen <andersen@codepoet.org>2000-04-04 18:14:25 +0000
committerErik Andersen <andersen@codepoet.org>2000-04-04 18:14:25 +0000
commit983b51b17bb36e5b77cb160abdfbcf9d25675dd9 (patch)
tree13642fcca428d88a6a25f768ee45c99e9c13cdc6 /init
parent3364d78b18386623e7af5da18ba1bb0cc6286279 (diff)
downloadbusybox-983b51b17bb36e5b77cb160abdfbcf9d25675dd9.tar.gz
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')
-rw-r--r--init/init.c24
1 files changed, 22 insertions, 2 deletions
diff --git a/init/init.c b/init/init.c
index 907916537..f327a52af 100644
--- a/init/init.c
+++ b/init/init.c
@@ -45,7 +45,7 @@
#include <sys/reboot.h>
#include <sys/sysinfo.h> /* For check_free_memory() */
#ifdef BB_SYSLOGD
-#include <sys/syslog.h>
+# include <sys/syslog.h>
#endif
#include <sys/sysmacros.h>
#include <sys/types.h>
@@ -54,6 +54,15 @@
#include <termios.h>
#include <unistd.h>
+
+/*
+ * When CORE_ENABLE_FLAG_FILE exists, setrlimit is called before
+ * process is spawned to set corelimit to unlimited.
+ */
+#define CORE_ENABLE_FLAG_FILE "/.init_enable_core"
+#include <sys/resource.h>
+#include <sys/time.h>
+
#ifndef KERNEL_VERSION
#define KERNEL_VERSION(a,b,c) (((a) << 16) + ((b) << 8) + (c))
#endif
@@ -406,6 +415,16 @@ static pid_t run(char *command, char *terminal, int get_enter)
cmd[i] = NULL;
}
+ {
+ struct stat sb;
+ if (stat (CORE_ENABLE_FLAG_FILE, &sb) == 0) {
+ struct rlimit limit;
+ limit.rlim_cur = RLIM_INFINITY;
+ limit.rlim_max = RLIM_INFINITY;
+ setrlimit(RLIMIT_CORE, &limit);
+ }
+ }
+
/* Now run it. The new program will take over this PID,
* so nothing further in init.c should be run. */
execve(cmd[0], cmd, environment);
@@ -836,6 +855,7 @@ extern int init_main(int argc, char **argv)
close(1);
close(2);
set_term(0);
+ chdir("/");
setsid();
/* Make sure PATH is set to something sane */
@@ -881,7 +901,7 @@ extern int init_main(int argc, char **argv)
* of "askfirst" shells */
parse_inittab();
}
-
+
/* Fix up argv[0] to be certain we claim to be init */
strncpy(argv[0], "init", strlen(argv[0])+1);
if (argc > 1)