Re: Opinions on removing /proc/tty?

From: Albert Cahalan
Date: Mon Jul 10 2006 - 21:07:16 EST


On 7/10/06, Jan Engelhardt <jengelh@xxxxxxxxxxxxxxx> wrote:
>> > Just do /proc/*/tty links and all will be good. This even
>> > handles the case of two different names for the same dev_t.
>> >
>> Is this for the controlling tty? Then it should be ctty.
>
> Eeeew, an extra byte so it can look ugly.
> What other special tty is there?
>
Any fd, for that matter.

00:09 shanghai:/dev/shm > ls -l /proc/$$/fd
total 4
dr-x------ 2 jengelh users 0 Jul 11 00:16 .
dr-xr-xr-x 5 jengelh root 0 Jul 11 00:04 ..
lrwx------ 1 jengelh users 64 Jul 11 00:16 0 -> /dev/pts/2
lrwx------ 1 jengelh users 64 Jul 11 00:16 1 -> /dev/pts/2
lrwx------ 1 jengelh users 64 Jul 11 00:16 2 -> /dev/pts/2
lrwx------ 1 jengelh users 64 Jul 11 00:16 255 -> /dev/pts/2
and CTTY is /dev/tty1.

So what would /proc/$$/tty - ambiguous name - point to, the normal (attached)
or the ctty? Not to mention exotic, yet possible things

The tty is obviously one and the same as:

a. "tty" in the kernel's struct signal_struct
b. the "TTY" or "TT" reported by ps.
c. what "/dev/tty" refers to

Any other tty is not "the tty". Exactly one tty is special.

On any of Linux, MacOS, Solaris, NetBSD, OpenBSD:

$ ls /dev/tty /dev/ctty
ls: /dev/ctty: No such file or directory
/dev/tty

Lord only knows why FreeBSD has both.
Unlike Linux, they don't supply a man page.
On a Linux system, "man 4 tty" is useful.
On a Solaris system, "man -s 7d tty" is useful.
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/