Blame man4/tty.4

Packit 7cfc04
.\" Copyright (c) 1993 Michael Haardt (michael@moria.de),
Packit 7cfc04
.\"     Fri Apr  2 11:32:09 MET DST 1993
Packit 7cfc04
.\"
Packit 7cfc04
.\" %%%LICENSE_START(GPLv2+_DOC_FULL)
Packit 7cfc04
.\" This is free documentation; you can redistribute it and/or
Packit 7cfc04
.\" modify it under the terms of the GNU General Public License as
Packit 7cfc04
.\" published by the Free Software Foundation; either version 2 of
Packit 7cfc04
.\" the License, or (at your option) any later version.
Packit 7cfc04
.\"
Packit 7cfc04
.\" The GNU General Public License's references to "object code"
Packit 7cfc04
.\" and "executables" are to be interpreted as the output of any
Packit 7cfc04
.\" document formatting or typesetting system, including
Packit 7cfc04
.\" intermediate and printed output.
Packit 7cfc04
.\"
Packit 7cfc04
.\" This manual is distributed in the hope that it will be useful,
Packit 7cfc04
.\" but WITHOUT ANY WARRANTY; without even the implied warranty of
Packit 7cfc04
.\" MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
Packit 7cfc04
.\" GNU General Public License for more details.
Packit 7cfc04
.\"
Packit 7cfc04
.\" You should have received a copy of the GNU General Public
Packit 7cfc04
.\" License along with this manual; if not, see
Packit 7cfc04
.\" <http://www.gnu.org/licenses/>.
Packit 7cfc04
.\" %%%LICENSE_END
Packit 7cfc04
.\"
Packit 7cfc04
.\" Modified 1993-07-24 by Rik Faith (faith@cs.unc.edu)
Packit 7cfc04
.\" Modified 2003-04-07 by Michael Kerrisk
Packit 7cfc04
.\"
Packit 7cfc04
.TH TTY 4 2017-11-26 "Linux" "Linux Programmer's Manual"
Packit 7cfc04
.SH NAME
Packit 7cfc04
tty \- controlling terminal
Packit 7cfc04
.SH DESCRIPTION
Packit 7cfc04
The file
Packit 7cfc04
.I /dev/tty
Packit 7cfc04
is a character file with major number 5 and
Packit 7cfc04
minor number 0, usually of mode 0666 and owner.group root.tty.
Packit 7cfc04
It is a synonym for the controlling terminal of a process, if any.
Packit 7cfc04
.PP
Packit 7cfc04
In addition to the
Packit 7cfc04
.BR ioctl (2)
Packit 7cfc04
requests supported by the device that
Packit 7cfc04
.B tty
Packit 7cfc04
refers to, the
Packit 7cfc04
.BR ioctl (2)
Packit 7cfc04
request
Packit 7cfc04
.B TIOCNOTTY
Packit 7cfc04
is supported.
Packit 7cfc04
.SS TIOCNOTTY
Packit 7cfc04
Detach the calling process from its controlling terminal.
Packit 7cfc04
.PP
Packit 7cfc04
If the process is the session leader,
Packit 7cfc04
then
Packit 7cfc04
.B SIGHUP
Packit 7cfc04
and
Packit 7cfc04
.B SIGCONT
Packit 7cfc04
signals are sent to the foreground process group
Packit 7cfc04
and all processes in the current session lose their controlling tty.
Packit 7cfc04
.PP
Packit 7cfc04
This
Packit 7cfc04
.BR ioctl (2)
Packit 7cfc04
call works only on file descriptors connected
Packit 7cfc04
to
Packit 7cfc04
.IR /dev/tty .
Packit 7cfc04
It is used by daemon processes when they are invoked
Packit 7cfc04
by a user at a terminal.
Packit 7cfc04
The process attempts to open
Packit 7cfc04
.IR /dev/tty .
Packit 7cfc04
If the open succeeds, it
Packit 7cfc04
detaches itself from the terminal by using
Packit 7cfc04
.BR TIOCNOTTY ,
Packit 7cfc04
while if the
Packit 7cfc04
open fails, it is obviously not attached to a terminal and does not need
Packit 7cfc04
to detach itself.
Packit 7cfc04
.SH FILES
Packit 7cfc04
.I /dev/tty
Packit 7cfc04
.SH SEE ALSO
Packit 7cfc04
.BR chown (1),
Packit 7cfc04
.BR mknod (1),
Packit 7cfc04
.BR ioctl (2),
Packit 7cfc04
.BR ioctl_console (2),
Packit 7cfc04
.BR ioctl_tty (2),
Packit 7cfc04
.BR termios (3),
Packit 7cfc04
.BR ttyS (4),
Packit 7cfc04
.BR agetty (8),
Packit 7cfc04
.BR mingetty (8)
Packit 7cfc04
.SH COLOPHON
Packit 7cfc04
This page is part of release 4.15 of the Linux
Packit 7cfc04
.I man-pages
Packit 7cfc04
project.
Packit 7cfc04
A description of the project,
Packit 7cfc04
information about reporting bugs,
Packit 7cfc04
and the latest version of this page,
Packit 7cfc04
can be found at
Packit 7cfc04
\%https://www.kernel.org/doc/man\-pages/.