From owner-freebsd-hackers Thu Dec 14 10:55:15 1995 Return-Path: owner-hackers Received: (from root@localhost) by freefall.freebsd.org (8.7.3/8.7.3) id KAA27232 for hackers-outgoing; Thu, 14 Dec 1995 10:55:15 -0800 (PST) Received: from godzilla.zeta.org.au (godzilla.zeta.org.au [203.2.228.19]) by freefall.freebsd.org (8.7.3/8.7.3) with SMTP id KAA27225 for ; Thu, 14 Dec 1995 10:55:11 -0800 (PST) Received: (from bde@localhost) by godzilla.zeta.org.au (8.6.9/8.6.9) id FAA04916; Fri, 15 Dec 1995 05:48:08 +1100 Date: Fri, 15 Dec 1995 05:48:08 +1100 From: Bruce Evans Message-Id: <199512141848.FAA04916@godzilla.zeta.org.au> To: ache@astral.msk.su, bde@zeta.org.au, terry@lambert.org Subject: Re: bug or feature in kern/tty.c Cc: eugen@rd.zgik.zaporizhzhe.ua, hackers@FreeBSD.ORG, yura@rd.zgik.zaporizhzhe.ua Sender: owner-hackers@FreeBSD.ORG Precedence: bulk >>I.e. >>1) driver needs to track carrier when in TS_ZOMBI and >>set TS_CONNECTED, clear TS_ZOMBI when carrier >>appearse on the line. The driver tracks carrier in TS_CARR_ON and the modem hardware state independent of CLOCAL and controlling terminalness. TS_CARR_ON can't be seen by normal processes but can be seen by snooping in kmem, e.g., by pstat. The driver is careful to NOT set TS_CONNECTED or clear TS_ZOMBIE when carrier rises, since that would defeat the whole point of TS_ZOMBIE, which is to stop the next call from being answered by the current session if the session leader somehow survives the SIGHUP. >>2) Slattach not need exit on SIGHUP but wait reasonable time >>until carrier will be up again. >I mean of course that CLOCAL turned on, i.e. slattach only >controls line and establish carrier on them, not other >program. So partial question is: is it possible to fix sio to send >SIGHUP to controlling terminal even when CLOCAL is set? No, for a SIGHUP to be sent, CLOCAL must be clear and the line must be a controlling process. slattach could simply poll for hangup like /usr/bin/sppp, e.g., assert(not_a_controlling_terminal_here); for (;;) { int mstate; sleep(2); if (ioctl(fd, TIOCMGET, &mstate) != 0 || !(mstate & TIOCM_CD)) break; } /* * XXX in !CLOCAL mode, we would have to close and reopen the tty * since POSIX says that the tty can't be used after the connection * is broken. This is inconvenient, and since we check carrier * directly, we don't need !CLOCAL mode. */ assert(in_CLOCAL_mode); goto start; except there is a race: the TIOCM_CD bit isn't sticky, so transient changes of it might be missed. Bruce