| 1 |
.\" Copyright, the authors of the Linux man-pages project |
| 2 |
.\" |
| 3 |
.\" SPDX-License-Identifier: GPL-2.0-or-later |
| 4 |
.\" |
| 5 |
.TH tty 4 2025-05-17 "Linux man-pages 6.18" |
| 6 |
.SH NAME |
| 7 |
tty \- controlling terminal |
| 8 |
.SH DESCRIPTION |
| 9 |
The file |
| 10 |
.I /dev/tty |
| 11 |
is a character file with major number 5 and |
| 12 |
minor number 0, usually with mode 0666 and ownership root:tty. |
| 13 |
It is a synonym for the controlling terminal of a process, if any. |
| 14 |
.P |
| 15 |
In addition to the |
| 16 |
.BR ioctl (2) |
| 17 |
requests supported by the device that |
| 18 |
.B tty |
| 19 |
refers to, the |
| 20 |
.BR ioctl (2) |
| 21 |
request |
| 22 |
.B TIOCNOTTY |
| 23 |
is supported. |
| 24 |
.SS TIOCNOTTY |
| 25 |
Detach the calling process from its controlling terminal. |
| 26 |
.P |
| 27 |
If the process is the session leader, |
| 28 |
then |
| 29 |
.B SIGHUP |
| 30 |
and |
| 31 |
.B SIGCONT |
| 32 |
signals are sent to the foreground process group |
| 33 |
and all processes in the current session lose their controlling tty. |
| 34 |
.P |
| 35 |
This |
| 36 |
.BR ioctl (2) |
| 37 |
call works only on file descriptors connected |
| 38 |
to |
| 39 |
.IR /dev/tty . |
| 40 |
It is used by daemon processes when they are invoked |
| 41 |
by a user at a terminal. |
| 42 |
The process attempts to open |
| 43 |
.IR /dev/tty . |
| 44 |
If the open succeeds, it |
| 45 |
detaches itself from the terminal by using |
| 46 |
.BR TIOCNOTTY , |
| 47 |
while if the |
| 48 |
open fails, it is obviously not attached to a terminal and does not need |
| 49 |
to detach itself. |
| 50 |
.SH FILES |
| 51 |
.I /dev/tty |
| 52 |
.SH SEE ALSO |
| 53 |
.BR chown (1), |
| 54 |
.BR mknod (1), |
| 55 |
.BR ioctl (2), |
| 56 |
.BR ioctl_console (2), |
| 57 |
.BR ioctl_tty (2), |
| 58 |
.BR termios (3), |
| 59 |
.BR ttyS (4), |
| 60 |
.BR vcs (4), |
| 61 |
.BR pty (7), |
| 62 |
.BR agetty (8), |
| 63 |
.BR mingetty (8) |