summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--lib/libc/sys/open.216
-rw-r--r--sys/sys/fcntl.h5
2 files changed, 20 insertions, 1 deletions
diff --git a/lib/libc/sys/open.2 b/lib/libc/sys/open.2
index 8fc6d76..3a5979f 100644
--- a/lib/libc/sys/open.2
+++ b/lib/libc/sys/open.2
@@ -28,7 +28,7 @@
.\" @(#)open.2 8.2 (Berkeley) 11/16/93
.\" $FreeBSD$
.\"
-.Dd April 10, 2008
+.Dd February 28, 2009
.Dt OPEN 2
.Os
.Sh NAME
@@ -116,6 +116,7 @@ O_FSYNC synchronous writes
O_SYNC synchronous writes
O_NOFOLLOW do not follow symlinks
O_NOCTTY don't assign controlling terminal
+O_TTY_INIT restore default terminal attributes
.Ed
.Pp
Opening a file with
@@ -208,6 +209,19 @@ The
system call will not assign controlling terminals on
.Fx .
.Pp
+.Dv O_TTY_INIT
+may be used to ensure the OS restores the terminal attributes when
+initially opening a TTY.
+This is the default on
+.Fx ,
+but is present for
+.Tn POSIX
+compatibility.
+The initial call to
+.Fn open
+on a TTY will always restore default terminal attributes on
+.Fx .
+.Pp
If successful,
.Fn open
returns a non-negative integer, termed a file descriptor.
diff --git a/sys/sys/fcntl.h b/sys/sys/fcntl.h
index 600ddd8..c3cbc51 100644
--- a/sys/sys/fcntl.h
+++ b/sys/sys/fcntl.h
@@ -140,6 +140,11 @@ typedef __pid_t pid_t;
#define FEXEC O_EXEC
#endif
+/* Defined by POSIX 1003.1-2008; BSD default, but reserve for future use. */
+#if __POSIX_VISIBLE >= 200809
+#define O_TTY_INIT 0x00080000 /* Restore default termios attributes */
+#endif
+
/*
* XXX missing O_DSYNC, O_RSYNC.
*/
OpenPOWER on IntegriCloud