[BusyBox] init & ash & job control

Dick Streefland Dick.Streefland at xs4all.nl
Sun May 5 13:26:03 UTC 2002


On Wednesday 2002-05-01 10:28, Richard Wilson wrote:
| I'm trying to modify a working embedded system to replace
| much of it with busybox.  However, I'm having some startup
| problems.
| 
| In particular, I can't seem to get job control for my ash shell.
| 
| If inittab contains something like
|    ::respawn:-/bin/sh
| I get the message "sh: can't access tty; job control turned off"

I had the same problem. If you use "askfirst" instead of "respawn", you
get a controlling tty, and job control works. I've added a new
configuration option BB_FEATURE_ALWAYS_TTY to force the allocation of a
controlling tty, regardless of the init action (see patch below).

Is there a reason why the controlling tty allocation code is conditional?

-- 
Dick Streefland                    ////               De Bilt
dick.streefland at xs4all.nl         (@ @)       The Netherlands
------------------------------oOO--(_)--OOo------------------

--- busybox-0.60.3/Config.h.orig	Sat Apr  6 06:22:15 2002
+++ busybox-0.60.3/Config.h	Sun May  5 15:02:54 2002
@@ -225,6 +225,9 @@
 //Make sure nothing is printed to the console on boot
 //#define BB_FEATURE_EXTRA_QUIET
 //
+// Always give a process started by init a controlling tty
+//#define BB_FEATURE_ALWAYS_TTY
+//
 // enable syslogd -R remotehost
 #define BB_FEATURE_REMOTE_LOG
 //
--- busybox-0.60.3/init.c.orig	Sat Apr 27 06:12:55 2002
+++ busybox-0.60.3/init.c	Sun May  5 15:02:54 2002
@@ -520,7 +520,9 @@
 
 		/* If the init Action requires up to wait, then force the
 		 * supplied terminal to be the controlling tty. */
+#ifndef BB_FEATURE_ALWAYS_TTY
 		if (a->action & (SYSINIT|WAIT|CTRLALTDEL|SHUTDOWN|RESTART|ASKFIRST)) {
+#endif
 
 			/* Take over the controlling tty */
 			ioctl(fd, TIOCSCTTY, 1);
@@ -572,10 +574,12 @@
 			}
 
 			/* Now fall though to actually execute things */
+#ifndef BB_FEATURE_ALWAYS_TTY
 		} else {
 			dup(fd);
 			dup(fd);
 		}
+#endif
 
 		/* See if any special /bin/sh requiring characters are present */
 		if (strpbrk(a->command, "~`!$^&*()=|\\{}[];\"'<>?") != NULL) {



More information about the busybox mailing list