From: dliu@ace.njit.edu (Dong Liu) Subject: Re: 0.99pl6 and serial login doesn't work for me Date: 17 Mar 1993 06:03:32 GMT
>>>>> On 11 Mar 93 21:51:24 GMT, harakka_j@kulminator.salcom.fi said:
hj> OK, I have done some debugging on this tonight. What I did was that I told
hj> getty to use gdb as login-program (instead of login). Then I answered to the
hj> login: promt with the name of my real login-program so that gdb got it as
hj> first argument. That way I was able to run login with gdb (Thanks for the
hj> hint Joachim <sprave@gonzo.informatik.uni-dortmund.de>!). Before that I
hj> off course compiled the login program (shadow version) with debug information.
hj> That way I was able to trace the problem down to the point where getpass()
hj> function tried to do fopen on /dev/tty, which seem to cause the hang. My
hj> question is: Am I mocking things up by running the gdb, or could the fopen
hj> on /dev/tty be the real reason of the problem? Any comments anybody?
hj> - juha -
The problem is agetty.c clears the CLOCAL bit, so next time a open() on
this device causes kernel to wait for carrier detect. So the open()
would be blocked on a local serial line. You can try this by
"stty -clocal </dev/ttyS3", then a "ls >/dev/ttyS3" would be blocked.
I have posted a fix yesterday, but that was not in diff form, so here is
the diff
--- agetty.c.org Wed Mar 17 00:45:40 1993
+++ agetty.c Sun Mar 14 22:08:44 1993
@@ -652,7 +652,10 @@
(void) ioctl(0, TCFLSH, 2);
#endif
- tp->c_cflag = CS8 | HUPCL | CREAD | speed;
+/* tp->c_cflag = CS8 | HUPCL | CREAD | speed; */
+ /* should preseve the terminal CLOCAL. dliu */
+ ioctl (0, TCGETA, tp);
+ tp->c_cflag = CS8 | HUPCL | CREAD | speed | (tp -> c_cflag&CLOCAL);
tp->c_iflag = tp->c_lflag = tp->c_oflag = tp->c_line = 0;
tp->c_cc[VMIN] = 1;
tp->c_cc[VTIME] = 0;
Cheers