Page Menu
Home
FreeBSD
Search
Configure Global Search
Log In
Files
F144425695
D36745.id111061.diff
No One
Temporary
Actions
View File
Edit File
Delete File
View Transforms
Subscribe
Mute Notifications
Flag For Later
Award Token
Size
2 KB
Referenced Files
None
Subscribers
None
D36745.id111061.diff
View Options
diff --git a/bin/stty/stty.1 b/bin/stty/stty.1
--- a/bin/stty/stty.1
+++ b/bin/stty/stty.1
@@ -32,7 +32,7 @@
.\" @(#)stty.1 8.4 (Berkeley) 4/18/94
.\" $FreeBSD$
.\"
-.Dd May 24, 2022
+.Dd September 27, 2022
.Dt STTY 1
.Os
.Sh NAME
@@ -40,7 +40,7 @@
.Nd set the options for a terminal device interface
.Sh SYNOPSIS
.Nm
-.Op Fl a | e | g
+.Op Fl a | e | g | i
.Op Fl f Ar file
.Op Ar arguments
.Sh DESCRIPTION
@@ -85,6 +85,23 @@
.Nm
to restore the current terminal state as per
.St -p1003.2 .
+.It Fl i
+Allow
+.Nm
+to change terminal settings even when executing in background
+process group (see description of the job control in
+.Xr termios 4 ) .
+Normally, such attempt results in kernel sending the
+.Va SIGTTOU
+signal and stopping of the process until its group is returned
+to foreground.
+Using this option makes
+.Nm
+ignore
+.Va SIGTTOU .
+.Pp
+Note that changing terminal settings for running foreground
+job that is not prepared to it might cause inconsistencies.
.El
.Pp
The following arguments are available to set the terminal
diff --git a/bin/stty/stty.c b/bin/stty/stty.c
--- a/bin/stty/stty.c
+++ b/bin/stty/stty.c
@@ -47,6 +47,7 @@
#include <err.h>
#include <fcntl.h>
#include <limits.h>
+#include <signal.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
@@ -59,6 +60,7 @@
main(int argc, char *argv[])
{
struct info i;
+ struct sigaction sa;
enum FMT fmt;
int ch;
const char *file, *errstr = NULL;
@@ -69,8 +71,8 @@
opterr = 0;
while (optind < argc &&
- strspn(argv[optind], "-aefg") == strlen(argv[optind]) &&
- (ch = getopt(argc, argv, "aef:g")) != -1)
+ strspn(argv[optind], "-aefgi") == strlen(argv[optind]) &&
+ (ch = getopt(argc, argv, "aef:gi")) != -1)
switch(ch) {
case 'a': /* undocumented: POSIX compatibility */
fmt = POSIX;
@@ -86,6 +88,12 @@
case 'g':
fmt = GFLAG;
break;
+ case 'i':
+ memset(&sa, 0, sizeof(sa));
+ sa.sa_handler = SIG_IGN;
+ if (sigaction(SIGTTOU, &sa, NULL) == -1)
+ err(1, "sigaction");
+ break;
case '?':
default:
goto args;
@@ -161,6 +169,6 @@
{
(void)fprintf(stderr,
- "usage: stty [-a | -e | -g] [-f file] [arguments]\n");
+ "usage: stty [-a | -e | -g] [-i] [-f file] [arguments]\n");
exit (1);
}
File Metadata
Details
Attached
Mime Type
text/plain
Expires
Mon, Feb 9, 9:22 AM (5 h, 55 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
28562774
Default Alt Text
D36745.id111061.diff (2 KB)
Attached To
Mode
D36745: stty(1): provide details about interaction with job control
Attached
Detach File
Event Timeline
Log In to Comment