[BusyBox] ash (busybox) problem:"job control turned off" -- getty (tinylogin) problem: errno 25: Not a typewriter (printed as "Inappropriate ioctl for device")
cajus.hahn at de.abb.com
cajus.hahn at de.abb.com
Fri Jun 7 04:15:04 UTC 2002
Hi,
I am using busybox 0.60.3 and tinylogin 1.02 on a x86 linux box with 2.4.18
kernel.
I use busybox ash as shell with job control turned on.
I call getty from inittab with:
ttyS1::askfirst:/sbin/getty -Lt10 ttyS1 115200 vt100
after entering the password the busybox built-in shell ash starts with
"sh: can´t access tty; job control turned off"
I found out, that this results from problem with getty:
in getty_main() is a part
#ifdef __linux__
{
int iv;
iv = getpid();
if (ioctl(0, TIOCSPGRP, &iv) < 0)
perror_msg("ioctl() TIOCSPGRP call failed");
}
#endif
The ioctl fails with error 25 !
By the way, there is no error output on my system.
I suggest adding a sleep(2) after perror_msg()!
If you do this you will see the error message:
"getty: ioctl() TIOCSPGRP call failed: Inappropriate ioctl for device"
Tracking the reason for this error back to the tty_io.c in the kernel
sources:
The controlling tty is still the init process, not the getty process!
This leads to ENOTTY (Not a typewriter) which might mean "Not the
controlling TTY"!?
I found a solution in busybox init.c / run():
/* Take over the controlling tty */
ioctl(fd, TIOCSCTTY, 1);
I placed this in getty.c, it now looks like
/* take over the controlling tty to avoid ENOTTY */
/* (Taken from busybox init.c) */
ioctl(1, TIOCSCTTY, 1);
#ifdef __linux__
{
int iv;
iv = getpid();
if (ioctl(0, TIOCSPGRP, &iv) < 0)
{
perror_msg("ioctl() TIOCSPGRP call failed");
sleep(2);
}
}
#endif
I am not sure if the change should be placed inside the "#ifdef __linux__".
Cajus
(cajus.hahn at de.abb.com)
More information about the busybox
mailing list