From owner-freebsd-questions Mon Jan 2 16:40:49 1995 Return-Path: questions-owner Received: (from root@localhost) by freefall.cdrom.com (8.6.9/8.6.6) id QAA07926 for questions-outgoing; Mon, 2 Jan 1995 16:40:49 -0800 Received: from cs.weber.edu (cs.weber.edu [137.190.16.16]) by freefall.cdrom.com (8.6.9/8.6.6) with SMTP id QAA07920 for ; Mon, 2 Jan 1995 16:40:47 -0800 Received: by cs.weber.edu (4.1/SMI-4.1.1) id AA02451; Mon, 2 Jan 95 17:34:46 MST From: terry@cs.weber.edu (Terry Lambert) Message-Id: <9501030034.AA02451@cs.weber.edu> Subject: Re: Serial port questions To: jeff@tenforwd.wiz.com (Jeff Haynes) Date: Mon, 2 Jan 95 17:34:45 MST Cc: freebsd-questions@freebsd.org In-Reply-To: <199501021738.LAA03256@tenforwd.wiz.com> from "Jeff Haynes" at Jan 2, 95 11:38:54 am X-Mailer: ELM [version 2.4dev PL52] Sender: questions-owner@freebsd.org Precedence: bulk > I am having a problem getting slattach to work while mgetty is running. > slattach will dial out, but then mgetty seems to take over. This seems > to be a locking problem. Darn right! mgetty should be "locked out" of having its open complete until DCD is present! Because mgetty violates the rules, you get bogus behaviour. The SCO uugetty used to violate the rules as well. It was hacked to respect lock files (and to create them) and then retry its open something like once every 20 seconds until the lock file went away. > UUCP and mgetty work fine together, so I think this is a problem with > how slattach locks the line. I had no problems in 1.1.5.1. I am running > 2.0 now. Yes and no; mgetty's open of the line not hanging for DCD to become present is unutterably bogus. > slattach, mgetty and UUCP are using ttyd0 (not cua0 and ttyd0); this should > be a bidirectional port right? A bidirectional port is only bidirectional if incoming opens are incomplete without DCD present and the device prevents DCD from coming present if the outgoing device for the port is already open. > Can somebody please help me out? A terrifically gross "fix" for this is possible: 1) Make the port the controlling tty for mgetty. 2) Make mgetty respect SIGHUP. When it gets SIGHUP, have it close and reopen the line. 3) Modify the tty code. When the outgoing port is openend AND the incoming (mgetty) port is fully open (ie: it is violating the rules like mgetty does and ignoring DCD), send SIGHUP to the process group for the tty. Note that outgoing connections must either not establish the port as their controlling tty, or must do so after this, or the SIGHUP delivery needs to be internal to the tty code (ie: it doesn't really signal the process group, only the part process group on the incoming side). 4) Modify the tty code. When an open is attempted on the incoming device AND the outgoing device is already open, block the open on the incoming device even if it is cheating (like mgetty does) using O_NDELAY. 5) Modify the tty code. When an open is blocked on the incoming device (a result of #4 above), and the last close occurs on the outgoing device, unblock the open on the incoming device. This would probably be the "correct" way to do it, since it would only get tickled if the incoming open refused to wait for DCD like it is most definitely supposed to, according to all that is Holy (mgetty is the spawn of Satan, it only looks like a child process of init). I should not have to twiddle meta-state about a device other than the device information itself (via ioctl()). Lock files are evil, and are the work of AT&T SVR3.x. Multiple processes wanting to go out simultaneously need to be mediated by the exclusive use bit, with special dispensation to exclusive use on tty's being given in the fork() code that duplictes the descriptor table. Terry Lambert terry@cs.weber.edu --- Any opinions in this posting are my own and not those of my present or previous employers.