aboutsummaryrefslogtreecommitdiff
path: root/share/man/man4/tty.4
diff options
context:
space:
mode:
authorKyle Evans <kevans@FreeBSD.org>2019-11-30 20:10:50 +0000
committerKyle Evans <kevans@FreeBSD.org>2019-11-30 20:10:50 +0000
commit1b50b999f9b57eff89002c40559487de9ac43646 (patch)
treee9ccddcce63daa5a58b1d8e07d340f979edce297 /share/man/man4/tty.4
parent46413cedf7efc0551beee17a323101632f41ac98 (diff)
downloadsrc-1b50b999f9b57eff89002c40559487de9ac43646.tar.gz
src-1b50b999f9b57eff89002c40559487de9ac43646.zip
tty: implement TIOCNOTTY
Generally, it's preferred that an application fork/setsid if it doesn't want to keep its controlling TTY, but it could be that a debugger is trying to steal it instead -- so it would hook in, drop the controlling TTY, then do some magic to set things up again. In this case, TIOCNOTTY is quite handy and still respected by at least OpenBSD, NetBSD, and Linux as far as I can tell. I've dropped the note about obsoletion, as I intend to support TIOCNOTTY as long as it doesn't impose a major burden. Reviewed by: bcr (manpages), kib Differential Revision: https://reviews.freebsd.org/D22572
Notes
Notes: svn path=/head/; revision=355248
Diffstat (limited to 'share/man/man4/tty.4')
-rw-r--r--share/man/man4/tty.413
1 files changed, 10 insertions, 3 deletions
diff --git a/share/man/man4/tty.4 b/share/man/man4/tty.4
index d47a5d510cce..b3b9f67db35d 100644
--- a/share/man/man4/tty.4
+++ b/share/man/man4/tty.4
@@ -28,7 +28,7 @@
.\" @(#)tty.4 8.3 (Berkeley) 4/19/94
.\" $FreeBSD$
.\"
-.Dd January 11, 2017
+.Dd November 27, 2019
.Dt TTY 4
.Os
.Sh NAME
@@ -194,7 +194,6 @@ Simulate typed input.
Pretend as if the terminal received the character pointed to by
.Fa cp .
.It Dv TIOCNOTTY Fa void
-This call is obsolete but left for compatibility.
In the past, when a process that did not have a controlling terminal (see
.Em The Controlling Terminal
in
@@ -203,7 +202,7 @@ first opened a terminal device, it acquired that terminal as its
controlling terminal.
For some programs this was a hazard as they
did not want a controlling terminal in the first place, and this
-provided a mechanism to disassociate the controlling terminal from
+provides a mechanism to disassociate the controlling terminal from
the calling process.
It
.Em must
@@ -228,6 +227,14 @@ system call which will place the process into its own session - which
has the effect of disassociating it from the controlling terminal.
This is the new and preferred method for programs to lose their controlling
terminal.
+.Pp
+However, environmental restrictions may prohibit the process from being able to
+.Fn fork
+and call the
+.Fn setsid
+system call to disassociate it from the controlling terminal.
+In this case, it must use
+.Dv TIOCNOTTY .
.It Dv TIOCSTOP Fa void
Stop output on the terminal (like typing ^S at the keyboard).
.It Dv TIOCSTART Fa void