Minor structural change to allow core dumping(or not) from init

-Erik
This commit is contained in:
Erik Andersen 2000-04-04 18:36:37 +00:00
parent 983b51b17b
commit 183da4ade1
4 changed files with 35 additions and 21 deletions

View File

@ -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 <pavel_roskin@geocities.com>:
- 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 <bob@earthrise.demon.co.uk> for the patch.
* Fix "+" parsing bug in date, from "Merle F. McClelland" <mfm@cts.com>.
-Erik Andersen

View File

@ -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
//

10
init.c
View File

@ -55,13 +55,17 @@
#include <unistd.h>
#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 <sys/resource.h>
#include <sys/time.h>
#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. */

View File

@ -55,13 +55,17 @@
#include <unistd.h>
#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 <sys/resource.h>
#include <sys/time.h>
#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. */