diff options
| author | Jeremie Koenig <jk@jk.fr.eu.org> | 2010-07-30 06:21:21 +0200 |
|---|---|---|
| committer | Denys Vlasenko <vda.linux@googlemail.com> | 2010-07-30 17:40:37 +0200 |
| commit | 430ba79c39eeed4725c36e9c2ad61c438c8a5d3e (patch) | |
| tree | 0f825a715ccacb032df7d09dedd2f9cc1b1a4137 /shell | |
| parent | 85a359afab4743e68977086bddac301ef0675ee1 (diff) | |
| download | busybox-w32-430ba79c39eeed4725c36e9c2ad61c438c8a5d3e.tar.gz busybox-w32-430ba79c39eeed4725c36e9c2ad61c438c8a5d3e.tar.bz2 busybox-w32-430ba79c39eeed4725c36e9c2ad61c438c8a5d3e.zip | |
cttyhack: serial console detection is Linux-specific
Signed-off-by: Jeremie Koenig <jk@jk.fr.eu.org>
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
Diffstat (limited to 'shell')
| -rw-r--r-- | shell/cttyhack.c | 15 |
1 files changed, 12 insertions, 3 deletions
diff --git a/shell/cttyhack.c b/shell/cttyhack.c index a80d49dc3..3a78bae29 100644 --- a/shell/cttyhack.c +++ b/shell/cttyhack.c | |||
| @@ -13,7 +13,6 @@ | |||
| 13 | //config:config CTTYHACK | 13 | //config:config CTTYHACK |
| 14 | //config: bool "cttyhack" | 14 | //config: bool "cttyhack" |
| 15 | //config: default y | 15 | //config: default y |
| 16 | //config: depends on PLATFORM_LINUX | ||
| 17 | //config: help | 16 | //config: help |
| 18 | //config: One common problem reported on the mailing list is "can't access tty; | 17 | //config: One common problem reported on the mailing list is "can't access tty; |
| 19 | //config: job control turned off" error message which typically appears when | 18 | //config: job control turned off" error message which typically appears when |
| @@ -59,6 +58,10 @@ | |||
| 59 | //usage: "\nStarting interactive shell from boot shell script:" | 58 | //usage: "\nStarting interactive shell from boot shell script:" |
| 60 | //usage: "\n setsid cttyhack sh" | 59 | //usage: "\n setsid cttyhack sh" |
| 61 | 60 | ||
| 61 | #if !defined(__linux__) && !defined(TIOCGSERIAL) | ||
| 62 | # warning cttyhack will not be able to detect a controlling tty on this system | ||
| 63 | #endif | ||
| 64 | |||
| 62 | /* From <linux/vt.h> */ | 65 | /* From <linux/vt.h> */ |
| 63 | struct vt_stat { | 66 | struct vt_stat { |
| 64 | unsigned short v_active; /* active vt */ | 67 | unsigned short v_active; /* active vt */ |
| @@ -112,13 +115,19 @@ int cttyhack_main(int argc UNUSED_PARAM, char **argv) | |||
| 112 | close(fd); | 115 | close(fd); |
| 113 | } else { | 116 | } else { |
| 114 | /* We don't have ctty (or don't have "/dev/tty" node...) */ | 117 | /* We don't have ctty (or don't have "/dev/tty" node...) */ |
| 115 | if (ioctl(0, TIOCGSERIAL, &u.sr) == 0) { | 118 | if (0) {} |
| 119 | #ifdef TIOCGSERIAL | ||
| 120 | else if (ioctl(0, TIOCGSERIAL, &u.sr) == 0) { | ||
| 116 | /* this is a serial console */ | 121 | /* this is a serial console */ |
| 117 | sprintf(console + 8, "S%d", u.sr.line); | 122 | sprintf(console + 8, "S%d", u.sr.line); |
| 118 | } else if (ioctl(0, VT_GETSTATE, &u.vt) == 0) { | 123 | } |
| 124 | #endif | ||
| 125 | #ifdef __linux__ | ||
| 126 | else if (ioctl(0, VT_GETSTATE, &u.vt) == 0) { | ||
| 119 | /* this is linux virtual tty */ | 127 | /* this is linux virtual tty */ |
| 120 | sprintf(console + 8, "S%d" + 1, u.vt.v_active); | 128 | sprintf(console + 8, "S%d" + 1, u.vt.v_active); |
| 121 | } | 129 | } |
| 130 | #endif | ||
| 122 | if (console[8]) { | 131 | if (console[8]) { |
| 123 | fd = xopen(console, O_RDWR); | 132 | fd = xopen(console, O_RDWR); |
| 124 | //bb_error_msg("switching to '%s'", console); | 133 | //bb_error_msg("switching to '%s'", console); |
