Subject: Re: On /dev/console, /dev/constty and the TIOCCONS ioctl
To: David Laight <david@l8s.co.uk>
From: Bill Studenmund <wrstuden@netbsd.org>
List: tech-kern
Date: 10/03/2003 20:33:18
--Kj7319i9nmIyA2yE
Content-Type: text/plain; charset=us-ascii
Content-Disposition: inline
Content-Transfer-Encoding: quoted-printable
On Fri, Oct 03, 2003 at 09:05:06PM +0100, David Laight wrote:
> I've committed changes today that add a /dev/constty device, and changed
> /etc/ttys so that getty (and hence any console login session) use it
> instead of /etc/console. init also uses it for single user mode.
[rearrangement]
> Anyone know where /dev/console is documanted?
Please revert these changes, at least until they get discussed.
This is an area of the kernel that if you do not feel fully comfortable
what's going on, you shouldn't be changing.
> Provided that MAKEDEV is run after /etc/ttys is updated this should
> all be transparant. init will fall back on /dev/console, and old kernels
> will treat /dev/constty the same way as they treat /dev/console.
>=20
> At least one other Unix system uses /dev/constty.
While that's a good reason to consider this, it's not a good justification=
=20
for having committed it.
> The only difference between /dev/console and /dev/constty is that output
> to the latter is not intercepted by the TIOCCONS ioctl.
=46rom your descriptions, I don't think that's the only change. You may hav=
e=20
meant it to be the only one, but I think there are more.
> I made the change because I want to capture kernel messages generated
> while sysinst is running in order to stop them 'messing up' the screen.
As something for install media, it's ok (I think). For main running=20
systems, though, I think you SHOULD NOT have just changed it.
> It also makes it possible to log in on the 'console' while xconsole
> (or similar) is running - a problem someone else mentioned yesterday.
>=20
> Without the change it is impossible for a program running from the console
> to output data to the console if TIOCCONS has been used to transfer kernel
> messages to a pty.
Uhm, why not just use the real devices? Once you've installed, your=20
console shouldn't be moving around, so using ttyE0 or tty0 or some such=20
isn't a big deal.
> I did look at trying to detects writes to a processes controlling termina=
l,
> however its tty structure is that for the underlying device (eg ttyE0)
> so that just doesn't work. You would need to have the vnode address
> available in the device driver write routine......
>=20
> The code changes are trivial (adding minor(dev) =3D=3D 0 to a few code pa=
ths)
> and updating 10^9 copies of MAKEDEV and /etc/ttys.
Did you verify that revoke works right? Also, what are the semantics of=20
something opening /dev/console and something running on /dev/constty?
> One loose end is that init gives anything it runs a controlling terminal
> of /dev/console. I'm not 100% clear this is correct. If any daemons
> are started that fail to lose their ctty, then ttyE0 (on i386) will be
> left with an attached session.=20
Why did you just commit this? It sounds like the change is a great thing=20
to patch for comment, but even you had too many questions for it to have=20
gone in. ??
Please revert it, and post a diff. While reverting would be volintary, if=
=20
you don't, you're setting a precident of, "It's ok because I committed=20
it." That doesn't do well for our code quality or peer review.
Take care,
Bill
--Kj7319i9nmIyA2yE
Content-Type: application/pgp-signature
Content-Disposition: inline
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.2.3 (NetBSD)
iD8DBQE/fj9+Wz+3JHUci9cRAtV7AJwP8Hnikd3q19CMRvtlrjF3fQwzhgCdFW3a
pvfkGIr4ZxDWN0+KEy+IJqM=
=73Cj
-----END PGP SIGNATURE-----
--Kj7319i9nmIyA2yE--