git: 298d7504ae5b - stable/13 - stty(1): provide details about interaction with job control

From: Konstantin Belousov <kib_at_FreeBSD.org>
Date: Sun, 09 Oct 2022 02:23:28 UTC
The branch stable/13 has been updated by kib:

URL: https://cgit.FreeBSD.org/src/commit/?id=298d7504ae5b83cb61816b5ef7ae987a153f9f49

commit 298d7504ae5b83cb61816b5ef7ae987a153f9f49
Author:     Konstantin Belousov <kib@FreeBSD.org>
AuthorDate: 2022-09-26 21:34:22 +0000
Commit:     Konstantin Belousov <kib@FreeBSD.org>
CommitDate: 2022-10-09 02:23:04 +0000

    stty(1): provide details about interaction with job control
    
    PR:     266627
    
    (cherry picked from commit a7eac018437e592a575f46a59151eedc7a742fa7)
---
 bin/stty/stty.1 | 28 +++++++++++++++++++++++++++-
 1 file changed, 27 insertions(+), 1 deletion(-)

diff --git a/bin/stty/stty.1 b/bin/stty/stty.1
index 1863c2286176..a72a0fee2355 100644
--- a/bin/stty/stty.1
+++ b/bin/stty/stty.1
@@ -32,7 +32,7 @@
 .\"     @(#)stty.1	8.4 (Berkeley) 4/18/94
 .\" $FreeBSD$
 .\"
-.Dd October 20, 2018
+.Dd September 27, 2022
 .Dt STTY 1
 .Os
 .Sh NAME
@@ -594,6 +594,32 @@ Same as the control character
 Same as the control character
 .Cm reprint .
 .El
+.Sh INTERACTION WITH JOB CONTROL
+Modifications to the terminal settings are treated by job control
+(see
+.Xr termios 4 )
+same as writes.
+When the
+.Nm
+utility is executing in a background process group,
+such attempts result in the kernel sending the
+.Dv SIGTTOU
+signal and stopping the process until its group is returned
+to foreground.
+The non-blocking open of the terminal device with the
+.Fl f
+option to
+.Nm
+does not affect the behavior.
+If it is desirable to modify the settings from the background,
+.Xr sh 1
+users might utilize the following idiom:
+.Bd -literal
+(trap '' TTOU; stty -f /dev/tty sane)
+.Ed
+.Pp
+Note that changing terminal settings for a running foreground
+job that is not prepared for it might cause inconsistencies.
 .Sh EXIT STATUS
 .Ex -std
 .Sh SEE ALSO