aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--TODO_config_nommu87
-rw-r--r--init/init.c50
-rw-r--r--networking/httpd.c2
3 files changed, 104 insertions, 35 deletions
diff --git a/TODO_config_nommu b/TODO_config_nommu
index 81db6db2f..d3deda278 100644
--- a/TODO_config_nommu
+++ b/TODO_config_nommu
@@ -1,7 +1,7 @@
#
# Automatically generated make config: don't edit
# Busybox version: 1.10.0.svn
-# Tue Jan 8 20:29:22 2008
+# Tue Feb 19 15:07:07 2008
#
CONFIG_HAVE_DOT_CONFIG=y
@@ -49,7 +49,7 @@ CONFIG_LFS=y
# Debugging Options
#
# CONFIG_DEBUG is not set
-CONFIG_WERROR=y
+# CONFIG_WERROR is not set
CONFIG_NO_DEBUG_LIB=y
# CONFIG_DMALLOC is not set
# CONFIG_EFENCE is not set
@@ -77,13 +77,13 @@ CONFIG_MD5_SIZE_VS_SPEED=2
# CONFIG_FEATURE_ETC_NETWORKS is not set
CONFIG_FEATURE_EDITING=y
CONFIG_FEATURE_EDITING_MAX_LEN=1024
-# CONFIG_FEATURE_EDITING_FANCY_KEYS is not set
# CONFIG_FEATURE_EDITING_VI is not set
CONFIG_FEATURE_EDITING_HISTORY=15
# CONFIG_FEATURE_EDITING_SAVEHISTORY is not set
CONFIG_FEATURE_TAB_COMPLETION=y
CONFIG_FEATURE_USERNAME_COMPLETION=y
CONFIG_FEATURE_EDITING_FANCY_PROMPT=y
+CONFIG_FEATURE_VERBOSE_CP_MESSAGE=y
CONFIG_FEATURE_COPYBUF_KB=4
CONFIG_MONOTONIC_SYSCALL=y
CONFIG_IOCTL_HEX2STR_ERROR=y
@@ -111,15 +111,17 @@ CONFIG_RPM=y
CONFIG_FEATURE_RPM_BZ2=y
CONFIG_TAR=y
CONFIG_FEATURE_TAR_CREATE=y
+CONFIG_FEATURE_TAR_GZIP=y
CONFIG_FEATURE_TAR_BZIP2=y
CONFIG_FEATURE_TAR_LZMA=y
-CONFIG_FEATURE_TAR_FROM=y
-CONFIG_FEATURE_TAR_GZIP=y
CONFIG_FEATURE_TAR_COMPRESS=y
+CONFIG_FEATURE_TAR_AUTODETECT=y
+CONFIG_FEATURE_TAR_FROM=y
CONFIG_FEATURE_TAR_OLDGNU_COMPATIBILITY=y
CONFIG_FEATURE_TAR_OLDSUN_COMPATIBILITY=y
CONFIG_FEATURE_TAR_GNU_EXTENSIONS=y
CONFIG_FEATURE_TAR_LONG_OPTIONS=y
+CONFIG_FEATURE_TAR_UNAME_GNAME=y
CONFIG_UNCOMPRESS=y
CONFIG_UNLZMA=y
CONFIG_FEATURE_LZMA_FAST=y
@@ -367,16 +369,16 @@ CONFIG_FEATURE_XARGS_SUPPORT_ZERO_TERM=y
#
# Init Utilities
#
-# CONFIG_INIT is not set
+CONFIG_INIT=y
# CONFIG_DEBUG_INIT is not set
-# CONFIG_FEATURE_USE_INITTAB is not set
-# CONFIG_FEATURE_KILL_REMOVED is not set
-CONFIG_FEATURE_KILL_DELAY=0
-# CONFIG_FEATURE_INIT_SCTTY is not set
-# CONFIG_FEATURE_INIT_SYSLOG is not set
-# CONFIG_FEATURE_EXTRA_QUIET is not set
-# CONFIG_FEATURE_INIT_COREDUMPS is not set
-# CONFIG_FEATURE_INITRD is not set
+CONFIG_FEATURE_USE_INITTAB=y
+CONFIG_FEATURE_KILL_REMOVED=y
+CONFIG_FEATURE_KILL_DELAY=1
+CONFIG_FEATURE_INIT_SCTTY=y
+CONFIG_FEATURE_INIT_SYSLOG=y
+CONFIG_FEATURE_EXTRA_QUIET=y
+CONFIG_FEATURE_INIT_COREDUMPS=y
+CONFIG_FEATURE_INITRD=y
CONFIG_HALT=y
CONFIG_MESG=y
@@ -391,6 +393,7 @@ CONFIG_FEATURE_ADDUSER_TO_GROUP=y
CONFIG_DELGROUP=y
CONFIG_FEATURE_DEL_USER_FROM_GROUP=y
CONFIG_ADDUSER=y
+CONFIG_FEATURE_ADDUSER_LONG_OPTIONS=y
CONFIG_DELUSER=y
CONFIG_GETTY=y
CONFIG_FEATURE_UTMP=y
@@ -459,6 +462,7 @@ CONFIG_FEATURE_SGI_LABEL=y
CONFIG_FEATURE_SUN_LABEL=y
CONFIG_FEATURE_OSF_LABEL=y
CONFIG_FEATURE_FDISK_ADVANCED=y
+CONFIG_FINDFS=y
CONFIG_FREERAMDISK=y
CONFIG_FSCK_MINIX=y
CONFIG_MKFS_MINIX=y
@@ -479,14 +483,48 @@ CONFIG_IPCS=y
CONFIG_LOSETUP=y
CONFIG_MDEV=y
CONFIG_FEATURE_MDEV_CONF=y
+CONFIG_FEATURE_MDEV_RENAME=y
CONFIG_FEATURE_MDEV_EXEC=y
CONFIG_FEATURE_MDEV_LOAD_FIRMWARE=y
CONFIG_MKSWAP=y
CONFIG_FEATURE_MKSWAP_V0=y
CONFIG_MORE=y
CONFIG_FEATURE_USE_TERMIOS=y
+CONFIG_VOLUMEID=y
+CONFIG_FEATURE_VOLUMEID_EXT=y
+CONFIG_FEATURE_VOLUMEID_REISERFS=y
+CONFIG_FEATURE_VOLUMEID_FAT=y
+CONFIG_FEATURE_VOLUMEID_HFS=y
+CONFIG_FEATURE_VOLUMEID_JFS=y
+CONFIG_FEATURE_VOLUMEID_UFS=y
+CONFIG_FEATURE_VOLUMEID_XFS=y
+CONFIG_FEATURE_VOLUMEID_NTFS=y
+CONFIG_FEATURE_VOLUMEID_ISO9660=y
+CONFIG_FEATURE_VOLUMEID_UDF=y
+CONFIG_FEATURE_VOLUMEID_LUKS=y
+CONFIG_FEATURE_VOLUMEID_LINUXSWAP=y
+CONFIG_FEATURE_VOLUMEID_LVM=y
+CONFIG_FEATURE_VOLUMEID_CRAMFS=y
+CONFIG_FEATURE_VOLUMEID_HPFS=y
+CONFIG_FEATURE_VOLUMEID_ROMFS=y
+CONFIG_FEATURE_VOLUMEID_SYSV=y
+CONFIG_FEATURE_VOLUMEID_MINIX=y
+CONFIG_FEATURE_VOLUMEID_MAC=y
+CONFIG_FEATURE_VOLUMEID_MSDOS=y
+CONFIG_FEATURE_VOLUMEID_OCFS2=y
+CONFIG_FEATURE_VOLUMEID_HIGHPOINTRAID=y
+CONFIG_FEATURE_VOLUMEID_ISWRAID=y
+CONFIG_FEATURE_VOLUMEID_LSIRAID=y
+CONFIG_FEATURE_VOLUMEID_VIARAID=y
+CONFIG_FEATURE_VOLUMEID_SILICONRAID=y
+CONFIG_FEATURE_VOLUMEID_NVIDIARAID=y
+CONFIG_FEATURE_VOLUMEID_PROMISERAID=y
+CONFIG_FEATURE_VOLUMEID_LINUXRAID=y
CONFIG_MOUNT=y
+CONFIG_FEATURE_MOUNT_FAKE=y
+CONFIG_FEATURE_MOUNT_VERBOSE=y
CONFIG_FEATURE_MOUNT_HELPERS=y
+CONFIG_FEATURE_MOUNT_LABEL=y
CONFIG_FEATURE_MOUNT_NFS=y
CONFIG_FEATURE_MOUNT_CIFS=y
CONFIG_FEATURE_MOUNT_FLAGS=y
@@ -494,6 +532,7 @@ CONFIG_FEATURE_MOUNT_FSTAB=y
CONFIG_PIVOT_ROOT=y
CONFIG_RDATE=y
CONFIG_READPROFILE=y
+CONFIG_RTCWAKE=y
CONFIG_SETARCH=y
CONFIG_SWAPONOFF=y
CONFIG_SWITCH_ROOT=y
@@ -511,6 +550,14 @@ CONFIG_FEATURE_MOUNT_LOOP=y
#
CONFIG_ADJTIMEX=y
# CONFIG_BBCONFIG is not set
+CONFIG_CHAT=y
+CONFIG_FEATURE_CHAT_NOFAIL=y
+CONFIG_FEATURE_CHAT_TTY_HIFI=y
+CONFIG_FEATURE_CHAT_IMPLICIT_CR=y
+CONFIG_FEATURE_CHAT_SWALLOW_OPTS=y
+CONFIG_FEATURE_CHAT_SEND_ESCAPES=y
+CONFIG_FEATURE_CHAT_VAR_ABORT_LEN=y
+CONFIG_FEATURE_CHAT_CLR_ABORT=y
CONFIG_CHRT=y
# CONFIG_CROND is not set
# CONFIG_DEBUG_CROND_OPTION is not set
@@ -523,6 +570,7 @@ CONFIG_DC=y
# CONFIG_DEVFSD_VERBOSE is not set
# CONFIG_FEATURE_DEVFS is not set
CONFIG_EJECT=y
+CONFIG_FEATURE_EJECT_SCSI=y
CONFIG_LAST=y
CONFIG_LESS=y
CONFIG_FEATURE_LESS_MAXLINES=9999999
@@ -564,6 +612,8 @@ CONFIG_FEATURE_PREFER_IPV4_ADDRESS=y
CONFIG_VERBOSE_RESOLUTION_ERRORS=y
CONFIG_ARP=y
CONFIG_ARPING=y
+CONFIG_BRCTL=y
+CONFIG_FEATURE_BRCTL_FANCY=y
CONFIG_DNSD=y
CONFIG_ETHER_WAKE=y
CONFIG_FAKEIDENTD=y
@@ -633,9 +683,15 @@ CONFIG_FEATURE_NETSTAT_WIDE=y
CONFIG_NSLOOKUP=y
CONFIG_PING=y
CONFIG_PING6=y
-CONFIG_PSCAN=y
CONFIG_FEATURE_FANCY_PING=y
+CONFIG_PSCAN=y
CONFIG_ROUTE=y
+CONFIG_SENDMAIL=y
+CONFIG_FEATURE_SENDMAIL_EHLO=y
+CONFIG_FEATURE_SENDMAIL_BLOATY=y
+CONFIG_FETCHMAIL=y
+CONFIG_FEATURE_FETCHMAIL_APOP=y
+CONFIG_FEATURE_FETCHMAIL_FILTER=y
CONFIG_SLATTACH=y
CONFIG_TELNET=y
CONFIG_FEATURE_TELNET_TTYPE=y
@@ -657,6 +713,7 @@ CONFIG_APP_DUMPLEASES=y
CONFIG_FEATURE_UDHCPD_WRITE_LEASES_EARLY=y
CONFIG_APP_UDHCPC=y
CONFIG_FEATURE_UDHCPC_ARPING=y
+CONFIG_FEATURE_UDHCP_PORT=y
CONFIG_FEATURE_UDHCP_DEBUG=y
CONFIG_FEATURE_RFC3397=y
CONFIG_UDHCPC_SLACK_FOR_BUGGY_SERVERS=80
diff --git a/init/init.c b/init/init.c
index a82b45b7c..13410ac39 100644
--- a/init/init.c
+++ b/init/init.c
@@ -117,11 +117,13 @@ static void loop_forever(void)
}
/* Print a message to the specified device.
- * Device may be bitwise-or'd from L_LOG | L_CONSOLE */
+ * "where" may be bitwise-or'd from L_LOG | L_CONSOLE
+ * NB: careful, we can be called after vfork!
+ */
#define messageD(...) do { if (ENABLE_DEBUG_INIT) message(__VA_ARGS__); } while (0)
-static void message(int device, const char *fmt, ...)
+static void message(int where, const char *fmt, ...)
__attribute__ ((format(printf, 2, 3)));
-static void message(int device, const char *fmt, ...)
+static void message(int where, const char *fmt, ...)
{
static int log_fd = -1;
va_list arguments;
@@ -137,7 +139,7 @@ static void message(int device, const char *fmt, ...)
if (ENABLE_FEATURE_INIT_SYSLOG) {
/* Log the message to syslogd */
- if (device & L_LOG) {
+ if (where & L_LOG) {
/* don't out "\r" */
openlog(applet_name, 0, LOG_DAEMON);
syslog(LOG_INFO, "init: %s", msg + 1);
@@ -157,20 +159,20 @@ static void message(int device, const char *fmt, ...)
log_fd = device_open(log_console, O_WRONLY | O_NONBLOCK | O_NOCTTY);
if (log_fd < 0) {
bb_error_msg("can't log to %s", log_console);
- device = L_CONSOLE;
+ where = L_CONSOLE;
} else {
close_on_exec_on(log_fd);
}
}
}
- if (device & L_LOG) {
+ if (where & L_LOG) {
full_write(log_fd, msg, l);
if (log_fd == 2)
return; /* don't print dup messages */
}
}
- if (device & L_CONSOLE) {
+ if (where & L_CONSOLE) {
/* Send console messages to console so people will see them. */
full_write(2, msg, l);
}
@@ -233,7 +235,8 @@ static void console_init(void)
putenv((char*)"TERM=linux");
}
-/* Set terminal settings to reasonable defaults */
+/* Set terminal settings to reasonable defaults.
+ * NB: careful, we can be called after vfork! */
static void set_sane_term(void)
{
struct termios tty;
@@ -270,7 +273,8 @@ static void set_sane_term(void)
tcsetattr(STDIN_FILENO, TCSANOW, &tty);
}
-/* Open the new terminal device */
+/* Open the new terminal device.
+ * NB: careful, we can be called after vfork! */
static void open_stdio_to_tty(const char* tty_name, int exit_on_failure)
{
/* empty tty_name means "use init's tty", else... */
@@ -286,6 +290,8 @@ static void open_stdio_to_tty(const char* tty_name, int exit_on_failure)
_exit(1);
if (ENABLE_DEBUG_INIT)
_exit(2);
+ /* NB: we don't reach this if we were called after vfork.
+ * Thus halt_reboot_pwoff() itself need not be vfork-safe. */
halt_reboot_pwoff(SIGUSR1); /* halt the system */
}
dup2(0, 1);
@@ -294,22 +300,24 @@ static void open_stdio_to_tty(const char* tty_name, int exit_on_failure)
set_sane_term();
}
-/* wrapper around exec:
- * takes string (max COMMAND_SIZE chars)
- * runs [-]/bin/sh -c "exec ......." if '>' etc detected.
- * otherwise splits words on whitespace and deals with leading dash.
+/* Wrapper around exec:
+ * Takes string (max COMMAND_SIZE chars).
+ * If chars like '>' detected, execs '[-]/bin/sh -c "exec ......."'.
+ * Otherwise splits words on whitespace, deals with leading dash,
+ * and uses plain exec().
+ * NB: careful, we can be called after vfork!
*/
static void init_exec(const char *command)
{
char *cmd[COMMAND_SIZE / 2];
char buf[COMMAND_SIZE + 6]; /* COMMAND_SIZE+strlen("exec ")+1 */
- int dash = (command[0] == '-');
+ int dash = (command[0] == '-' /* maybe? && command[1] == '/' */);
/* See if any special /bin/sh requiring characters are present */
if (strpbrk(command, "~`!$^&*()=|\\{}[];\"'<>?") != NULL) {
strcpy(buf, "exec ");
strcpy(buf + 5, command + dash); /* excluding "-" */
- /* LIBBB_DEFAULT_LOGIN_SHELL has leading dash */
+ /* NB: LIBBB_DEFAULT_LOGIN_SHELL define has leading dash */
cmd[0] = (char*)(LIBBB_DEFAULT_LOGIN_SHELL + !dash);
cmd[1] = (char*)"-c";
cmd[2] = buf;
@@ -351,7 +359,7 @@ static pid_t run(const struct init_action *a)
sigemptyset(&nmask);
sigaddset(&nmask, SIGCHLD);
sigprocmask(SIG_BLOCK, &nmask, &omask);
- pid = fork();
+ pid = vfork();
sigprocmask(SIG_SETMASK, &omask, NULL);
if (pid < 0)
@@ -379,8 +387,9 @@ static pid_t run(const struct init_action *a)
setsid();
/* Open the new terminal device */
- open_stdio_to_tty(a->terminal, 1 /* - exit if open fails*/);
+ open_stdio_to_tty(a->terminal, 1 /* - exit if open fails */);
+// NB: do not enable unless you change vfork to fork above
#ifdef BUT_RUN_ACTIONS_ALREADY_DOES_WAITING
/* If the init Action requires us to wait, then force the
* supplied terminal to be the controlling tty. */
@@ -424,7 +433,9 @@ static pid_t run(const struct init_action *a)
/* Child - fall though to actually execute things */
}
#endif
- if (a->action_type & ASKFIRST) {
+
+ /* NB: on NOMMU we can't wait for input in child */
+ if (BB_MMU && (a->action_type & ASKFIRST)) {
static const char press_enter[] ALIGN1 =
#ifdef CUSTOMIZED_BANNER
#include CUSTOMIZED_BANNER
@@ -809,7 +820,8 @@ static void reload_signal(int sig ATTRIBUTE_UNUSED)
}
}
#if CONFIG_FEATURE_KILL_DELAY
- if (fork() == 0) { /* child */
+ /* NB: parent will wait in NOMMU case */
+ if ((BB_MMU ? fork() : vfork()) == 0) { /* child */
sleep(CONFIG_FEATURE_KILL_DELAY);
for (a = init_action_list; a; a = a->next) {
pid_t pid = a->pid;
diff --git a/networking/httpd.c b/networking/httpd.c
index 2c580b032..bcd1126a6 100644
--- a/networking/httpd.c
+++ b/networking/httpd.c
@@ -2192,7 +2192,7 @@ static void mini_httpd_nommu(int server_socket, int argc, char **argv)
/* Wait for connections... */
fromAddr.len = LSA_SIZEOF_SA;
- n = accept(server_socket, &fromAddr.sa, &fromAddr.len);
+ n = accept(server_socket, &fromAddr.u.sa, &fromAddr.len);
if (n < 0)
continue;