Usenet comp.sys.dec (1990-2013)
 help / color / mirror / Atom feed
From: ltf@ncmicro.lonestar.org (Lance Franklin)
Subject: getty line-sharing questions
Date: 14 Oct 91 21:52:44 GMT	[thread overview]
Message-ID: <497@ncmicro.lonestar.org> (raw)

Here's a quick question...in trying to bring up a new getty program for
Ultrix 4.2, I'm having a bit of a problem getting it to work in shared
mode with uucp, etc.  I've seen examples of sharing a serial port using
TIOCSINUSE in tip/cu/uucp type programs, but none for a getty-type program,
where the program sits on the port waiting for activity.  the getty program
I'm playing with does the following:


/*
 * getty -- adapt to terminal speed on dialup, and call login
 *
 * Melbourne getty, June 83, kre.
 */

...
[stuff deleted to get to the good stuff]
...

	    strcpy(ttyn, dev);
	    strncat(ttyn, argv[2], sizeof(ttyn)-sizeof(dev));
	    if (strcmp(argv[0], "+") != 0) {
		chown(ttyn, 0, 0);
		chmod(ttyn, 0622);
		/*
		 * Delay the open so DTR stays down long enough to be detected.
		 */
		sleep(2);
		close(0);
		close(1);
		vhangup();
		while (open(ttyn, O_RDWR) != 0) {
			if (repcnt % 10 == 0) {
				syslog(LOG_ERR, "%s: %m", ttyn);
				closelog();
			}
			repcnt++;
			sleep(60);
		}
		signal(SIGHUP, SIG_IGN);
		(void) open(ttyn, O_RDWR);
		close(0);
		dup(1);
		dup(0);
		signal(SIGHUP, SIG_DFL);
	    }
	}


Now, I'm not quite sure I understand why the two opens, and which one
sits and waits for activity.  And I'm sure somewhere in this code, there
needs to be an ioctl that tells other programs that the tty's in use, but
I'm a bit lost as to what actually happens here.

Can anybody help me?

By the way, does anybody have a clue as to why the Ultrix getty should
suddenly begin dropping incoming calls?  Outgoing calls are fine, but
for some reason, the modem is dropping off almost immediatly after the
carrier is detected, with no apparent conversations intervening.  With
the above newgetty, no problems with incoming calls, but outgoing calls
via uucico are not working, due to newgetty grabbing the line as unshared.

Lance
-- 
Lance T. Franklin            +----------------------------------------------+
(ltf@ncmicro.lonestar.org)   | "You want I should bop you with this here    |
NC Microproducts, Inc.       |    Lollipop?!?"                 The Fat Fury |
Richardson, Texas            +----------------------------------------------+


                 reply	other threads:[~1991-10-14 21:52 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed
read-only archive

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox