Why does a process have to have a tty open for stty to work (SysV)

ian reid ir at crosfield.co.uk
Wed Feb 27 22:11:26 AEST 1991


On all the System V machines I have worked on, I'm not sure about BSD flavours,
if you wish to change the settings of a tty line using stty that tty line had
to be opened by a process for the changes to take effect.

I have come across this most recently when trying to setup COM3 on a PC running
Interactive UNIX 2.2, to send debugging output to a VT100 terminal.

No gettys or any other process are running on COM3. COM3 is /dev/tty01

So the following sequence occurs.

prompt> stty < /dev/tty01
speed 300 baud; <rest of report deleted>
prompt> stty 9600 < /dev/tty01
prompt> stty < /dev/tty01
speed 300 baud; <rest of report deleted>
prompt> sleep 1000 > /dev/tty01&
prompt> stty 9600 < /dev/tty01
prompt> stty < /dev/tty01
speed 9600 baud; <rest of report deleted>

Of course another interesting thing is stty works on the standard input for
SysV systems, but on the standard output for BSD systems.

So why does another process have to have the tty device open for the changes to
work, and why the difference described in the previous paragraph between
different stty implementations.
-- 
Ian Reid 					#include <std/disclaimer.h>
UUCP: ir at cel.uucp or ir at cel.co.uk or    ...!{ukc,mcsun,uunet}!cel!ir
"Computers..proof positive that no-one yet understands how to describe any real
 world situation in 0's and 1's."



More information about the Comp.unix.questions mailing list