Subject: getty failing in login_tty
To: None <netbsd-help@NetBSD.ORG>
From: Brook Milligan <brook@trillium.NMSU.Edu>
List: netbsd-help
Date: 05/17/1997 11:03:09
I am still trying to get getty to respond when a modem answers the
line. Getty now opens the port, but (apparently) fails when it calls
login_tty(). Below is a portion of getty (from main.c) and the log
output generated (note that /* XXX */ is logging code I added; the
rest is the 1.2 distributed version). I am at a loss about how to
track down the problem with login_tty; any help is greatly
appreciated.
Thanks for your help.
Cheers,
Brook
===========================================================================
modem port:
lrwxr-xr-x 1 root wheel 5 Jan 11 14:39 /dev/modem -> tty02
crw------- 1 root wheel 8, 2 May 17 10:42 /dev/tty02
===========================================================================
/etc/ttys (in part):
modem "/usr/libexec/getty Pc" unknown on rtscts
===========================================================================
/usr/src/libexec/getty/main.c (in part; installed as /usr/libexec/getty):
#ifndef lint
/*static char sccsid[] = "from: @(#)main.c 8.1 (Berkeley) 6/20/93";*/
static char rcsid[] = "$Id: main.c,v 1.17 1996/05/15 23:46:52 jtc Exp $";
#endif /* not lint */
<parts deleted>
int
main(argc, argv)
int argc;
char *argv[];
{
<parts deleted>
if (argc <= 2 || strcmp(argv[2], "-") == 0)
strcpy(ttyn, ttyname(0));
else {
int i;
strcpy(ttyn, dev);
strncat(ttyn, argv[2], sizeof(ttyn)-sizeof(dev));
if (strcmp(argv[0], "+") != 0) {
chown(ttyn, 0, 0);
chmod(ttyn, 0600);
revoke(ttyn);
/*
* Delay the open so DTR stays down long enough to be detected.
*/
sleep(2);
syslog(LOG_ERR, "opening %s", ttyn); /* XXX */
while ((i = open(ttyn, O_RDWR)) == -1) {
if ((repcnt % 10 == 0) &&
(errno != ENXIO || !failopenlogged)) {
syslog(LOG_ERR, "%s: %m", ttyn);
closelog();
failopenlogged = 1;
}
repcnt++;
sleep(60);
}
syslog(LOG_ERR, "%s open: fd=%d", ttyn, i); /* XXX */
syslog(LOG_ERR, "calling login_tty(%d)", i); /* XXX */
login_tty(i);
syslog(LOG_ERR, "login_tty(%d) returned", i); /* XXX */
}
}
<remainder deleted>
===========================================================================
syslog messages:
May 17 10:40:39 trillium getty[11316]: opening /dev/modem
May 17 10:41:28 trillium getty[11316]: /dev/modem open: fd=1
May 17 10:41:28 trillium getty[11316]: calling login_tty(1)
May 17 10:42:16 trillium getty[11320]: opening /dev/modem
Note that these are consecutive messages so it appears that a new
getty is spawned after login_tty() is called and the log message
immediately following the login_tty() call is never made.
Thanks for any help you can offer on how to trace the problem.