Subject: Re: tty0?
To: Jukka Marin <jmarin@pyy.jmp.fi>
From: Bill Studenmund <skippy@macro.stanford.edu>
List: current-users
Date: 06/22/1996 16:06:32
On Sat, 22 Jun 1996, Jukka Marin wrote:

> > This is sort of a religious war; some operating systems keep the state
> > between device closes, others reset it.  I see the advantages to each,
> > but I think I prefer the "reset to known state" mode.
> 
> Absolutely.  How would dial-in tty lines work at all if someone mangled
> the tty flags and logged off - the flags would stay wrong forever.  I
> feel the flags _must_ be reset when the device is closed.

Note: well-written, sane programs always seem to set the flags the
way they want them. Here we're only talking about what happens when the
user/administrator gets lazy. As I do on occasion. :-)

Also, at present (and in at least the 1.1 release), different ports made
different choices about this behavior. The mac68k and (I think) atari
ports did NOT reset defaults on subsuquent first-opens.

I think the best answer is that it should be changable; YOU decide what
YOU want YOUR system to do. For a multi-person, or a production system, it
makes sense to reset defaults after each close. Conversely, on my system
at home, when I'm debugging talking to my DeskWriter, I want to stty some
settings and have them stay. Using some #%*&&*#$ port-holding program
seems frustrating and silly. 

So I vote it's changable. On a per-tty basis.

Actually, this change is TRIVIAL! I've already implimented it in the zstty
code the mac68k port is using (which is different from the M.I. zstty as
Gordon and I haven't merged differences fully).

Most serial driver open commands have an
if (it's not already open) {
	reset the flags
}

block. All I did to change it was make it:

if ((it's not already open) && (private_data->reset_defaults != 0)) {
	reset the flags
}

At present, we don't have any way to change the flag, but its inclusion
was an effort at making the code more M.I. (each port can choose its own
behavior), but I have an idea about making it setable.

About preserving softcar, etc: Gordon's M.I. zstty code has an extra set
of flags representing things like local and hw handshaking. They get
changed on a flag-set ioctl, and, during a first-open, get copied to the
flags right after the defaults get imposed. I don't know how other drivers
do it.

Take care,

Bill