Subject: Re: On /dev/console, /dev/constty and the TIOCCONS ioctl
To: Bill Studenmund <wrstuden@netbsd.org>
From: David Laight <david@l8s.co.uk>
List: tech-kern
Date: 10/06/2003 21:24:00
> > The problem is that you need to run a getty on the device that is the
> > console 'this time the system booted'.  This is the default for 34 ports,
> > only 15 have it disabled (acorn26 an playstation2 don't have a console line).
> 
> Agreed. As mentioned in my other note, I think Thor, myself, and others 
> think that this isn't hard as you can know the set of console devices, and 
> run a getty on each of them.

You can't know which serial lines have terminals on them.  You don't want
users having a 'secure' getty on a line connected to an external modem!

> > With devfs, /dev/constty could be a dynamically generated symlink to
> > the underlying console, but this is hard to do since /dev is still
> > readonly in some cases when the console is needed.
> 
> No, if we have a devfs, then we'd have the kernel do the right magic for 
> us. :-)

The kernel still needs to know whether you have opened /dev/console
in order to write a log message, or because you want it as a tty.
The only real way to distinguish the two is to change the name that
is opened.

> > Actually /dev/constty could be created as a duplicate /dev entry for
> > the real tty device (the major/minor is available from sysctl) during
> > system boot (once / is mounted RW).  This would remove many of the
> > ctty and revoke() issues.
> 
> Ooo..... That would kill a lot of problems in return for a little rc.d 
> scriptage. I vote for it! :-)

It is an alternative way of implementing /dev/constty - you still need
to change the name of the device in /etc/ttys.
Some magic will be needed to stop 2 gettys running on the same device.
But that can't be too hard.

Then /dev/console could be made write-only - actually that may break too
much :-(   However it could be stopped from being a ctty.
This would also remove all the problems of the permissions on /dev/console.
(I think, that if I login on the console, I can steal all the console messages!)

	David

-- 
David Laight: david@l8s.co.uk