diff options
author | Denis Vlasenko <vda.linux@googlemail.com> | 2009-03-19 02:35:44 +0000 |
---|---|---|
committer | Denis Vlasenko <vda.linux@googlemail.com> | 2009-03-19 02:35:44 +0000 |
commit | 5981ba5843ee0696c3fc7ecc192ff09e63e848f8 (patch) | |
tree | a5f560fa0534d91c34d59a2e4f93c2606249e694 /init/init.c | |
parent | 5c2b81470d0d2e0734866c57b29c2e2fa3e3bc13 (diff) | |
download | busybox-w32-5981ba5843ee0696c3fc7ecc192ff09e63e848f8.tar.gz busybox-w32-5981ba5843ee0696c3fc7ecc192ff09e63e848f8.tar.bz2 busybox-w32-5981ba5843ee0696c3fc7ecc192ff09e63e848f8.zip |
init: test for vt terminal with VT_OPENQRY,
assume that anything else is TERM=vt102, not TERM=linux.
(Serial console test is less correct)
Tentatively closes bug 195.
function old new delta
init_main 946 919 -27
Diffstat (limited to 'init/init.c')
-rw-r--r-- | init/init.c | 32 |
1 files changed, 5 insertions, 27 deletions
diff --git a/init/init.c b/init/init.c index 5c344cb63..ce264283a 100644 --- a/init/init.c +++ b/init/init.c | |||
@@ -14,6 +14,7 @@ | |||
14 | #include <paths.h> | 14 | #include <paths.h> |
15 | #include <sys/reboot.h> | 15 | #include <sys/reboot.h> |
16 | #include <sys/resource.h> | 16 | #include <sys/resource.h> |
17 | #include <linux/vt.h> | ||
17 | 18 | ||
18 | 19 | ||
19 | /* Was a CONFIG_xxx option. A lot of people were building | 20 | /* Was a CONFIG_xxx option. A lot of people were building |
@@ -161,33 +162,9 @@ static void message(int where, const char *fmt, ...) | |||
161 | } | 162 | } |
162 | } | 163 | } |
163 | 164 | ||
164 | /* From <linux/serial.h> */ | ||
165 | struct serial_struct { | ||
166 | int type; | ||
167 | int line; | ||
168 | unsigned int port; | ||
169 | int irq; | ||
170 | int flags; | ||
171 | int xmit_fifo_size; | ||
172 | int custom_divisor; | ||
173 | int baud_base; | ||
174 | unsigned short close_delay; | ||
175 | char io_type; | ||
176 | char reserved_char[1]; | ||
177 | int hub6; | ||
178 | unsigned short closing_wait; /* time to wait before closing */ | ||
179 | unsigned short closing_wait2; /* no longer used... */ | ||
180 | unsigned char *iomem_base; | ||
181 | unsigned short iomem_reg_shift; | ||
182 | unsigned int port_high; | ||
183 | unsigned long iomap_base; /* cookie passed into ioremap */ | ||
184 | int reserved[1]; | ||
185 | /* Paranoia (imagine 64bit kernel overwriting 32bit userspace stack) */ | ||
186 | uint32_t bbox_reserved[16]; | ||
187 | }; | ||
188 | static void console_init(void) | 165 | static void console_init(void) |
189 | { | 166 | { |
190 | struct serial_struct sr; | 167 | int vtno; |
191 | char *s; | 168 | char *s; |
192 | 169 | ||
193 | s = getenv("CONSOLE"); | 170 | s = getenv("CONSOLE"); |
@@ -211,8 +188,9 @@ static void console_init(void) | |||
211 | } | 188 | } |
212 | 189 | ||
213 | s = getenv("TERM"); | 190 | s = getenv("TERM"); |
214 | if (ioctl(STDIN_FILENO, TIOCGSERIAL, &sr) == 0) { | 191 | if (ioctl(STDIN_FILENO, VT_OPENQRY, &vtno) != 0) { |
215 | /* Force the TERM setting to vt102 for serial console | 192 | /* Not a linux terminal, probably serial console. |
193 | * Force the TERM setting to vt102 | ||
216 | * if TERM is set to linux (the default) */ | 194 | * if TERM is set to linux (the default) */ |
217 | if (!s || strcmp(s, "linux") == 0) | 195 | if (!s || strcmp(s, "linux") == 0) |
218 | putenv((char*)"TERM=vt102"); | 196 | putenv((char*)"TERM=vt102"); |