[BusyBox 0001075]: getty breaks on ioctl on MPC850
bugs at busybox.net
bugs at busybox.net
Tue Nov 21 14:37:48 UTC 2006
The following issue requires your FEEDBACK.
======================================================================
http://busybox.net/bugs/view.php?id=1075
======================================================================
Reported By: RenHoek
Assigned To: BusyBox
======================================================================
Project: BusyBox
Issue ID: 1075
Category: Other
Reproducibility: always
Severity: major
Priority: normal
Status: feedback
======================================================================
Date Submitted: 10-20-2006 06:00 PDT
Last Modified: 11-21-2006 06:37 PST
======================================================================
Summary: getty breaks on ioctl on MPC850
Description:
I'm trying upgrade from busybox 1.00 (which works) to 1.2.1, but I'm
running into trouble with getty. I'm on an embedded Motorola platform.
When init tries to start getty I get this error and getty exits:
I traced this to this bit in loginutils/getty.c
/*
* The following ioctl will fail if stdin is not a tty, but also
when
* there is noise on the modem control lines. In the latter case,
the
* common course of action is (1) fix your cables (2) give the
modem more
* time to properly reset after hanging up. SunOS users can
achieve (2)
* by patching the SunOS kernel variable "zsadtrlow" to a larger
value;
* 5 seconds seems to be a good value.
*/
if (ioctl(0, TCGETA, tp) < 0)
error("%s: ioctl: %m", tty);
When I comment it out, I get my login prompt. I fill in my username and
getty break again with this error:
getty: /dev/tts/0: ioctl: TCSETA: Invalid argument
Since 1.00 worked, I'll try and find out what has changed. I realise this
would be hard to reproduce for you guys since it's a custom platform, but
any tips are appreciated. :)
======================================================================
----------------------------------------------------------------------
RenHoek - 10-20-06 06:02
----------------------------------------------------------------------
Forgot to cut & paste the first error I get:
getty: /dev/tts/0: ioctl: Invalid argument
----------------------------------------------------------------------
RenHoek - 11-06-06 02:52
----------------------------------------------------------------------
I've got some more time to look into it. I copied the v1.0 getty.c into the
new 1.21. busybox. After compiling an running it, I still get the hangup.
So it would seem to be something outside of getty.c that hangs it up. I'm
using the same uclibc on both version so that shouldn't be it.
An strace of the 1.0 busybox getty and the new one reveals:
old:
chdir("/dev") = 0
stat("/dev/tts/0", {st_dev=makedev(0, 6), st_ino=18, st_mode=S_IFCHR|0600,
st_nlink=1, st_uid=0, st_gid=0, st_blksize=1024, st_blocks=0,
st_rdev=makedev(4, 64), st_atime=0, st_mtime=0, st_ctime=0}) = 0
close(0) = 0
open("/dev/tts/0", O_RDWR|O_NONBLOCK) = 0
dup(0) = 1
dup(0) = 2
ioctl(0, TCGETA, {c_iflags=0x300, c_oflags=0x3, c_cflags=0xcb00,
c_lflags=0x5cf, c_line=0,
c_cc="\x03\x1c\x7f\x15\x04\x01\x00\x00\x00\x00"}) = 0
chown("/dev/tts/0", 0, 0) = 0
chmod("/dev/tts/0", 0622) = 0
getpid() = 71
ioctl(0, TIOCSPGRP, [71]) = 0
ioctl(0, TCFLSH, 0x2) = 0
ioctl(0, TCSETA, {c_iflags=0, c_oflags=0, c_cflags=0xcb0d, c_lflags=0,
c_line=0, c_cc[_VMIN]=1, c_cc[_VTIME]=0,
c_cc="\x03\x1c\x7f\x15\x04\x01\x00\x00\x00\x00"}) = 0
fcntl(0, F_GETFL) = 0x802 (flags O_RDWR|O_NONBLOCK)
fcntl(0, F_SETFL, O_RDWR) = 0
new:
chdir("/dev") = 0
stat("/dev/tts/0", {st_dev=makedev(0, 6), st_ino=18, st_mode=S_IFCHR|0600,
st_nlink=1, st_uid=0, st_gid=0, st_blksize=1024, st_blocks=0,
st_rdev=makedev(4, 64), st_atime=0, st_mtime=0, st_ctime=0}) = 0
close(0) = 0
open("/dev/tts/0", O_RDWR|O_NONBLOCK) = 0
dup(0) = 1
dup(0) = 2
ioctl(0, TCGETS, 0x7fffecb0) = -1 EINVAL (Invalid argument)
The old busybox uses the ioctl correctly, while the new busybox apparently
uses some ioctl number strace doesn't even recognize. I would presume such
ioctl numbers are located in uclibc and thus unchanged.
I will continue my investigations.. :)
----------------------------------------------------------------------
vda - 11-06-06 17:19
----------------------------------------------------------------------
strace corresponds to this (code from current svn):
static void open_tty(char *tty, struct termio *tp, int local)
{
int chdir_to_root = 0;
if (strcmp(tty, "-")) {
xchdir("/dev");
chdir_to_root = 1;
xstat(tty, &st);
if ((st.st_mode & S_IFMT) != S_IFCHR) error...
fd = xopen(tty, O_RDWR | O_NONBLOCK);
if (fd) {
xdup2(fd, 0, tty);
close(fd);
}
} else { ... }
debug("duping\n");
xdup2(0, 1, tty);
xdup2(0, 2, tty);
if (ioctl(0, TCGETA, tp) < 0)
bb_perror_msg_and_die("%s: ioctl(TCGETA)", tty);
TCGETA ("get the termio structure associated with the terminal") doesn't
work. Hmm... what is this??
#ifdef TCGETS
#undef TCGETA
#undef TCSETA
#undef TCSETAW
#define termio termios
#define TCGETA TCGETS
#define TCSETA TCSETS
#define TCSETAW TCSETSW
#endif
Does removing this helps you?
----------------------------------------------------------------------
vda - 11-06-06 17:40
----------------------------------------------------------------------
Okay, I reviewed getty.c. I think trying to use ancient termio instead of
termios it not warranted. I am going to replace termio with termios in it
(in svn).
----------------------------------------------------------------------
vda - 11-21-06 06:37
----------------------------------------------------------------------
What is the status of this one? Does current svn work? ping...
Issue History
Date Modified Username Field Change
======================================================================
10-20-06 06:00 RenHoek New Issue
10-20-06 06:00 RenHoek Status new => assigned
10-20-06 06:00 RenHoek Assigned To => BusyBox
10-20-06 06:02 RenHoek Note Added: 0001712
11-06-06 02:52 RenHoek Note Added: 0001732
11-06-06 17:19 vda Note Added: 0001733
11-06-06 17:40 vda Note Added: 0001734
11-21-06 06:37 vda Note Added: 0001759
11-21-06 06:37 vda Status assigned => feedback
======================================================================
More information about the busybox-cvs
mailing list