Re: TIOCSCTTY

Theodore Ts'o (tytso@mit.edu)
Thu, 29 Jun 1995 18:52:00 +0500


From: Florian La Roche <florian@jurix.jura.uni-sb.de>
Date: Mon, 26 Jun 1995 15:35:56 +0200 (MET DST)

I just came across a BSD source file, that was changed for the linux
C library. I don't have any standard where I could look what needs
to be implemented. (Is there a standard??)
But it seems to be not a good idea, that normal BSD source has to be
modified to work, if no other document has clear words about this.

The problem is with ioctl TIOCSCTTY (set controlling tty) in
drivers/char/tty_io.c. Here is the relevant source:
The question is: Why do we check for "(arg == 1)" in the code below?

Hmm... my VAX BSD 4.3 machine is no longer running so I can't check the
BSD 4.3 manual pages, but as I recall I put that in there because to be
compatible with BSD! (BSD 4.3, anyway.)

I don't remember now why it was done this way, but I think I remeber
there being a good reason for doing this, since I went out of my way
code it up that way. (At least, I'm pretty sure I'm responsible for
TIOCSCTTY). Hmm... it's probably worth some investigation; look in
telnetd, getty, login, and bash, and if none of them ever seem to be
doing something fancy with TIOCSCTTY, the check is probably not
necessary. Or it might be worthwhile instrumenting the ioctl to see if
it's ever called with the argument set to zero, and see which program is
doing that and if it seems to be intentional. Another line of research
might be to find a BSD 4.3 manual page and see what it has to say about
TIOCSCTTY.

But if we can't find a reason to keep it, by all means, let's be
compatible with modern versions of BSD.

- Ted