Subject: Re: defaults for tty open
To: None <wrstuden@loki.Stanford.EDU>
From: Gordon W. Ross <>
List: tech-kern
Date: 01/30/1996 12:20:36
One clarification should be made below:

> From: (Bill Studenmund)
> Date: Mon, 29 Jan 1996 17:40:17 -0800 (PST)

				 (v--almost 8^)
> As part of porting Gordon Ross's M.I. Z8530 scc driver to the
> mac68k port, I have a question about setting the defaults
> on a tty port upon open.
> Basically the question is whether or not the defaults are always
> enforced upon open.

Note that defaults are set only on FIRST open, meaning that
nothing had the devcie open when this open call comes in.
The question is whether defaults should be set every time
the isopen flag goes from zero to one, or only the very
first time the device is ever opened.

> The old mac68k driver, the pmax, alpha, atari, and amiga (different
> chip) drivers all look to see if (tp->t_ispeed == 0) before setting
> the t_iflag, t_cflag, t_lflag, and t_oflag values to the defaults,

That will set defaults only if the device has NEVER been opened.
This allows someone to leave a useful state (or a GARBAGE state)
in the tty and have that preserved for the next "first open".

> The sun and sparc ssc drivers, and the isa/com driver have no such
> test. They'll reset the port to TTYDEF_xFLAG every time. Oh, the
> default speed also gets set. Additionally, it seems this latter
> behavior might be POSIX-required. ??

Not on every open, but only when the isopen flag goes from 0 to 1.