Subject: COM_SW_SOFTCAR handling (Was: Re: The pppd blocking thing...)
To: None <current-users@sun-lamp.cs.berkeley.edu>
From: Duncan McEwan <duncan@Comp.VUW.AC.NZ>
List: current-users
Date: 07/15/1994 10:46:46
> From: Tim Chase <tim@introl.introl.com>
> Subject: The pppd blocking thing... softcar works.
> Date: Wed, 13 Jul 1994 11:29:34 -0500 (CDT)
>
> ...
>
> setting the softcar flag from /etc/ttys works just fine and is obviously the
> proper solution to using pppd, tip or whatever for outgoing calls (if the
> program in question doesn't use a nonblocking open).
Perhaps. But Tim's message reminded me to investigate something that had
occured to me back when the ttyflags stuff was first added to /etc/ttys.
The way the COM_SW_SOFTCAR flag is currently handled means that while it is
set, DTR is held high even if no process has the tty open. This seems wrong to
me, since that flag should only be affecting whether a process thinks a carrier
signal is present, and should have nothing to do with the presence or absence
of a DTR signal. It means that when your tip, cu, pppd, or whatever exits,
your modem won't hang up even if it is configured with a "hang up on loss of
DTR" option.
This is explicitly controlled by the following code in isa/com.c
if (tp->t_cflag & HUPCL &&
(sc->sc_swflags & COM_SW_SOFTCAR) == 0)
/* XXX perhaps only clear DTR */
outb(iobase + com_mcr, 0);
Removing the COM_SW_SOFTCAR test causes the flag to behave as I think it should
wrt DTR.
However, if this change is made, I think it gives the COM_SW_SOFTCAR flag the
same semantics as COM_SW_CLOCAL (although they are implemented in different
ways). COM_SW_CLOCAL can be set by the "local" keyword in "/etc/ttys", so the
question then becomes: why have both?
It occurred to me that since CLOCAL could be interpreted as saying that the tty
is not connected to a modem, it's semantics could be changed to make it not
alter DTR at all. But I'm not sure if Posix allows this, and anyway, I can't
think of any reason why it would be useful :-)
If COM_SW_SOFTCAR stays as it is, I guess people wanting correct handling of
DTR, can use COM_SW_CLOCAL, but I think the semantics of "softcar" vs "local"
should be documented somewhere.
Comments, anyone?
Duncan
------------------------------------------------------------------------------