[git commit master] cttyhack: document the need to setsid

Denys Vlasenko vda.linux at googlemail.com
Sat May 15 18:43:07 UTC 2010


commit: http://git.busybox.net/busybox/commit/?id=b367bb2a620d3c349b0a61b949a6ebca32bf5395
branch: http://git.busybox.net/busybox/commit/?id=refs/heads/master

function                                             old     new   delta
packed_usage                                       26988   27057     +69

Signed-off-by: Denys Vlasenko <vda.linux at googlemail.com>
---
 include/usage.h |   12 ++++++++++--
 shell/Config.in |   15 +++++++++++++--
 2 files changed, 23 insertions(+), 4 deletions(-)

diff --git a/include/usage.h b/include/usage.h
index 9d9ad00..be52f18 100644
--- a/include/usage.h
+++ b/include/usage.h
@@ -649,8 +649,16 @@
      "\n	-S SALT" \
 	) \
 
-#define cttyhack_trivial_usage NOUSAGE_STR
-#define cttyhack_full_usage ""
+#define cttyhack_trivial_usage \
+       "PROG ARGS"
+#define cttyhack_full_usage "\n\n" \
+       "Give PROG a controlling tty if possible." \
+     "\nExample for /etc/inittab (for busybox init):" \
+     "\n	::respawn:/bin/cttyhack /bin/sh" \
+     "\nGiving controlling tty to shell running with PID 1:" \
+     "\n	$ exec cttyhack sh" \
+     "\nStarting an interative shell from boot shell script:" \
+     "\n	setsid cttyhack sh" \
 
 #define cut_trivial_usage \
        "[OPTIONS] [FILE]..."
diff --git a/shell/Config.in b/shell/Config.in
index 3b16506..36a9317 100644
--- a/shell/Config.in
+++ b/shell/Config.in
@@ -354,9 +354,20 @@ config CTTYHACK
 	  It analyzes stdin with various ioctls, trying to determine whether
 	  it is a /dev/ttyN or /dev/ttySN (virtual terminal or serial line).
 	  If it detects one, it closes stdin/out/err and reopens that device.
-	  Then it executes given program. Usage example for /etc/inittab
-	  (for busybox init):
+	  Then it executes given program. Opening the device will make
+	  that device a controlling tty. This may require cttyhack
+	  to be a session leader.
+
+	  Example for /etc/inittab (for busybox init):
 
 	  ::respawn:/bin/cttyhack /bin/sh
 
+	  Giving controlling tty to shell running with PID 1:
+
+	  $ exec cttyhack sh
+
+	  Starting an interative shell from boot shell script:
+
+	  setsid cttyhack sh
+
 endmenu
-- 
1.6.3.3



More information about the busybox-cvs mailing list