Subject: Re: tty0?
To: NetBSD <>
From: Ken Hornstein <>
List: current-users
Date: 06/21/1996 18:11:36
>Thanks for the replies, but that is exactly the point. We have some BSDi 
>boxes hanging around and setting the clocal flag on a port 
>keeps it set until you unset it, even after the port is closed, that is, 
>the state of the control flags is kept and not reset after every close.
>Isn't that how things should be set up? What's the point of using stty on 
>a device other the the controlling terminal if as soon as the command is 
>finished everything comes back to its defaults?

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.

>Is this the reason of the ttyflags command? If it is, how does it 
>permanently changes the state of a serial port? It probably opens and 
>closes the port to issue the ioctl commands, right? Wouldn't that last 
>close reset things back to normal.

It does open the serial port, but it doesn't issue the same ioctl() that
stty uses; it uses a "set the default mode on open" ioctl().

>How does one redirect the output of some commands to the serial port? The 
>shell doesn't know anything about it (I presume) and blocks when trying 
>to open the device.

If you don't like using "local" in /etc/ttys, you could do something like
this (taken from someone else's posts):

sleep 60 < /dev/tty00
stty -f /dev/tty00 -clocal (or whatever)
frob < /dev/tty00 > /dev/tty00