Date: Wed, 13 Dec 1995 11:18:46 -0700 (MST) From: Terry Lambert <terry@lambert.org> To: bde@zeta.org.au (Bruce Evans) Cc: eugen@rd.zgik.zaporizhzhe.ua, hackers@FreeBSD.ORG, yura@rd.zgik.zaporizhzhe.ua Subject: Re: bug or feature in kern/tty.c Message-ID: <199512131818.LAA03398@phaeton.artisoft.com> In-Reply-To: <199512131410.BAA23057@godzilla.zeta.org.au> from "Bruce Evans" at Dec 14, 95 01:10:41 am
next in thread | previous in thread | raw e-mail | index | archive | help
> >I found strange thing in 2.1.0-RELEASE (and -current) in kern/tty.c. > >When carrier was lossed then ttymodem() set TS_ZOMBIE and clear > >TS_CONNECTED in tp->t_state. But TS_ZOMBIE is cleared only in ttioctl() > >TIOCSETA* when line is setted to ignore modem status and when line is closed. > > POSIX says that (what I call the) zombie state remains until the line is > closed. Clearing it when CLOCAL is raised is a special hack that helped > very old (1.1.5) versions of slattach and perhaps other broken programs > work right. FYI: Of the 120 or so UNIX systems I ported TERM to while I was at Century Software, only SCO Xenix 2.3.0 behaved this way, and they fixed it in 2.3.1 after we reported the bug. Consider a program that splits the channel or uses seperate processes, or establishes the lock file before the open and frees it after the close. In the first couple of cases, you are talking about restarting the child processes. In the last case, you are talking about potentially contending for the lock yet again. Or consider attempting a redial on a Fax number. The outgoing modem mode by default is for talking with other modems. So you have to set the mode after the open because a close causes the on-to-off DTR transition that causes the modem to set. Hell, consider that any attempt to reestablish a connection will result in having to wait for the modem to reset itself. The problems are endless. The correct mechanisms for detecting on-to-off DCD transition are: 1) Make the serial line your controlling tty so that if -CLOCAL is set (like it should be), then on-to-off DCD will send you a SIGHUP. 2) Use "poll" or "select" to examine the tty for exceptional conditions. 3) Do an ioctl() the device at intervals after a connection is established (using an alarm or itimer if necessary) to get the DCD state. Returning 0 (or EOF) on reads is a silly thing to do. Terry Lambert terry@lambert.org --- Any opinions in this posting are my own and not those of my present or previous employers.
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?199512131818.LAA03398>
