CONTRIBUTING.d/patches: Please provide a git-range-diff(1)
[man-pages.git] / man4 / tty.4
blob7a0d214b6d5d52600e6eab8e20a1e96acffdecae
1 .\" Copyright (c) 1993 Michael Haardt (michael@moria.de),
2 .\"     Fri Apr  2 11:32:09 MET DST 1993
3 .\"
4 .\" SPDX-License-Identifier: GPL-2.0-or-later
5 .\"
6 .\" Modified 1993-07-24 by Rik Faith (faith@cs.unc.edu)
7 .\" Modified 2003-04-07 by Michael Kerrisk
8 .\"
9 .TH tty 4 (date) "Linux man-pages (unreleased)"
10 .SH NAME
11 tty \- controlling terminal
12 .SH DESCRIPTION
13 The file
14 .I /dev/tty
15 is a character file with major number 5 and
16 minor number 0, usually with mode 0666 and ownership root:tty.
17 It is a synonym for the controlling terminal of a process, if any.
19 In addition to the
20 .BR ioctl (2)
21 requests supported by the device that
22 .B tty
23 refers to, the
24 .BR ioctl (2)
25 request
26 .B TIOCNOTTY
27 is supported.
28 .SS TIOCNOTTY
29 Detach the calling process from its controlling terminal.
31 If the process is the session leader,
32 then
33 .B SIGHUP
34 and
35 .B SIGCONT
36 signals are sent to the foreground process group
37 and all processes in the current session lose their controlling tty.
39 This
40 .BR ioctl (2)
41 call works only on file descriptors connected
43 .IR /dev/tty .
44 It is used by daemon processes when they are invoked
45 by a user at a terminal.
46 The process attempts to open
47 .IR /dev/tty .
48 If the open succeeds, it
49 detaches itself from the terminal by using
50 .BR TIOCNOTTY ,
51 while if the
52 open fails, it is obviously not attached to a terminal and does not need
53 to detach itself.
54 .SH FILES
55 .I /dev/tty
56 .SH SEE ALSO
57 .BR chown (1),
58 .BR mknod (1),
59 .BR ioctl (2),
60 .BR ioctl_console (2),
61 .BR ioctl_tty (2),
62 .BR termios (3),
63 .BR ttyS (4),
64 .BR vcs (4),
65 .BR pty (7),
66 .BR agetty (8),
67 .BR mingetty (8)