pty bugs & features

John B. Milton jbm at celebr.uucp
Tue Sep 4 18:30:53 AEST 1990


In article <24356 at adm.BRL.MIL> and at ux.rfhsm.lon.ac.uk (Andy Holyer) writes:
>>>>>> On 29 Aug 90 15:44:50 GMT, Leslie Mikesell <les at chinet.chi.il.us> said:
>les> ....  The real problem is when you have
>les> placed a long distance call to or from a modem on a unix machine and
>les> pick up a ^S from line noise.  I've even seen cases where the device
>les> driver would lock up so that even a kill -9 wouldn't release the
>les> process and there was no way to drop the call without physical access to
>les> the modem.
>
>I've seen this problem quite frequently using terminals with XON/XOFF
>handshaking - I find that few sites are willing to pay for more than
>4-wire cabling IMH experience. A notable offender seems to be GNU's
>bash shell. On occasions the only way to unhang a line is to reboot
>(sometimes, I've even known a *power*down* to be necessary :-( )
>Is there a less drastic solution?
>...

Yes. I have a program I call "clocal" that is a tool for messing about with
ports. It has tons of error messages and signal handling, but it boils down
to this:

#include <fcntl.h>
#include <termio.h>
  f=open(line,O_RDONLY|O_NDELAY); /* always succeeds */
  ioctl(f,TCXONC,1); /* restart the UNIX side */
  ioctl(f,TCXONC,3); /* send a ^Q to the terminal */

On some SYSVs the driver does not handle NDELAY properly and the port will
become a tar baby. Any process that opens the port is stuck to it until reboot.
Some drivers will hang in the first ioctl.

John
-- 
John Bly Milton IV, jbm at uncle.UUCP, n8emr!uncle!jbm at osu-cis.cis.ohio-state.edu
(614) h:252-8544, w:469-1990; N8KSN, AMPR: 44.70.0.52; Don't FLAME, inform!



More information about the Comp.unix.internals mailing list