From 183da4ade108945f94117a633045cfd6f4ff813a Mon Sep 17 00:00:00 2001 From: Erik Andersen Date: Tue, 4 Apr 2000 18:36:37 +0000 Subject: [PATCH] Minor structural change to allow core dumping(or not) from init -Erik --- Changelog | 2 ++ busybox.def.h | 34 +++++++++++++++++----------------- init.c | 10 ++++++++-- init/init.c | 10 ++++++++-- 4 files changed, 35 insertions(+), 21 deletions(-) diff --git a/Changelog b/Changelog index da2924bca..3b083f3ab 100644 --- a/Changelog +++ b/Changelog @@ -42,6 +42,7 @@ the same, and prints an error (instead of endlessly looping). - mv now attempts to do a rename, and will fall back to doing a copy only if the rename fails. + - Syslogd now supports multiple concurrent connections * Several fixes from Pavel Roskin : - Fixes to sort. Removed "-g", fixed and added "-r" - Fixes to the makefile for handling "strip" @@ -56,6 +57,7 @@ the common error handling saves a few bytes. Thanks to Bob Tinsley for the patch. * Fix "+" parsing bug in date, from "Merle F. McClelland" . + -Erik Andersen diff --git a/busybox.def.h b/busybox.def.h index 53229ce1b..7b6d4e4ef 100644 --- a/busybox.def.h +++ b/busybox.def.h @@ -122,6 +122,12 @@ // at the same time... #define BB_FEATURE_USE_PROCFS // +// Enable full regular expressions. This adds about +// 4k. When this is off, things that would normally +// use regualr expressions (like grep) will just use +// normal strings. +#define BB_FEATURE_FULL_REGULAR_EXPRESSIONS +// // Use termios to manipulate the screen ('more' is prettier with this on) #define BB_FEATURE_USE_TERMIOS // @@ -146,6 +152,17 @@ //Enable init being called as /linuxrc //#define BB_FEATURE_LINUXRC // +//Have init enable core dumping for child processed (for debugging only) +//#define BB_FEATURE_INIT_COREDUMPS +// +// Allow init to permenently chroot, and umount the old root fs +// just like an initrd does. Requires a kernel patch by Werner Almesberger. +// ftp://icaftp.epfl.ch/pub/people/almesber/misc/umount-root-*.tar.gz +//#define BB_FEATURE_INIT_CHROOT +// +//Make sure nothing is printed to the console on boot +#define BB_FEATURE_EXTRA_QUIET +// //Simple tail implementation (2k vs 6k for the full one). Still //provides 'tail -f' support -- but for only one file at a time. #define BB_FEATURE_SIMPLE_TAIL @@ -156,7 +173,6 @@ // Enable support for a real /etc/mtab file instead of /proc/mounts //#define BB_FEATURE_MOUNT_MTAB_SUPPORT // -// // Enable support for remounting filesystems #define BB_FEATURE_REMOUNT // @@ -166,25 +182,9 @@ //// Enable reverse sort //#define BB_FEATURE_SORT_REVERSE // -// Allow init to permenently chroot, and umount the old root fs -// just like an initrd does. Requires a kernel patch by Werner Almesberger. -// ftp://icaftp.epfl.ch/pub/people/almesber/misc/umount-root-*.tar.gz -//#define BB_FEATURE_INIT_CHROOT -// -//Make sure nothing is printed to the console on boot -#define BB_FEATURE_EXTRA_QUIET -// -// Enable full regular expressions. This adds about -// 4k. When this is off, things that would normally -// use regualr expressions (like grep) will just use -// normal strings. -#define BB_FEATURE_FULL_REGULAR_EXPRESSIONS -// -// // Enable command line editing in the shell #define BB_FEATURE_SH_COMMAND_EDITING // -// //Turn on extra fbset options //#define BB_FEATURE_FBSET_FANCY // diff --git a/init.c b/init.c index f327a52af..d61d1c38e 100644 --- a/init.c +++ b/init.c @@ -55,13 +55,17 @@ #include +#if defined BB_FEATURE_INIT_COREDUMPS /* - * When CORE_ENABLE_FLAG_FILE exists, setrlimit is called before - * process is spawned to set corelimit to unlimited. + * When a file named CORE_ENABLE_FLAG_FILE exists, setrlimit is called + * before processes are spawned to set core file size as unlimited. + * This is for debugging only. Don't use this is production, unless + * you want core dumps lying about.... */ #define CORE_ENABLE_FLAG_FILE "/.init_enable_core" #include #include +#endif #ifndef KERNEL_VERSION #define KERNEL_VERSION(a,b,c) (((a) << 16) + ((b) << 8) + (c)) @@ -415,6 +419,7 @@ static pid_t run(char *command, char *terminal, int get_enter) cmd[i] = NULL; } +#if defined BB_FEATURE_INIT_COREDUMPS { struct stat sb; if (stat (CORE_ENABLE_FLAG_FILE, &sb) == 0) { @@ -424,6 +429,7 @@ static pid_t run(char *command, char *terminal, int get_enter) setrlimit(RLIMIT_CORE, &limit); } } +#endif /* Now run it. The new program will take over this PID, * so nothing further in init.c should be run. */ diff --git a/init/init.c b/init/init.c index f327a52af..d61d1c38e 100644 --- a/init/init.c +++ b/init/init.c @@ -55,13 +55,17 @@ #include +#if defined BB_FEATURE_INIT_COREDUMPS /* - * When CORE_ENABLE_FLAG_FILE exists, setrlimit is called before - * process is spawned to set corelimit to unlimited. + * When a file named CORE_ENABLE_FLAG_FILE exists, setrlimit is called + * before processes are spawned to set core file size as unlimited. + * This is for debugging only. Don't use this is production, unless + * you want core dumps lying about.... */ #define CORE_ENABLE_FLAG_FILE "/.init_enable_core" #include #include +#endif #ifndef KERNEL_VERSION #define KERNEL_VERSION(a,b,c) (((a) << 16) + ((b) << 8) + (c)) @@ -415,6 +419,7 @@ static pid_t run(char *command, char *terminal, int get_enter) cmd[i] = NULL; } +#if defined BB_FEATURE_INIT_COREDUMPS { struct stat sb; if (stat (CORE_ENABLE_FLAG_FILE, &sb) == 0) { @@ -424,6 +429,7 @@ static pid_t run(char *command, char *terminal, int get_enter) setrlimit(RLIMIT_CORE, &limit); } } +#endif /* Now run it. The new program will take over this PID, * so nothing further in init.c should be run. */ -- 2.25.1