[Midnightbsd-cvs] src [9422] trunk: Allow O_CLOEXEC in posix_openpt() flags.
laffer1 at midnightbsd.org
laffer1 at midnightbsd.org
Sat Mar 4 17:53:07 EST 2017
Revision: 9422
http://svnweb.midnightbsd.org/src/?rev=9422
Author: laffer1
Date: 2017-03-04 17:53:07 -0500 (Sat, 04 Mar 2017)
Log Message:
-----------
Allow O_CLOEXEC in posix_openpt() flags.
Modified Paths:
--------------
trunk/lib/libc/sys/posix_openpt.2
trunk/sys/kern/tty_pts.c
Modified: trunk/lib/libc/sys/posix_openpt.2
===================================================================
--- trunk/lib/libc/sys/posix_openpt.2 2017-03-04 22:52:29 UTC (rev 9421)
+++ trunk/lib/libc/sys/posix_openpt.2 2017-03-04 22:53:07 UTC (rev 9422)
@@ -37,7 +37,7 @@
.\"
.\" $MidnightBSD$
.\"
-.Dd August 20, 2008
+.Dd March 21, 2013
.Dt POSIX_OPENPT 2
.Os
.Sh NAME
@@ -71,7 +71,7 @@
are constructed by a bitwise-inclusive OR of flags from the following
list, defined in
.In fcntl.h :
-.Bl -tag -width ".Dv O_NOCTTY"
+.Bl -tag -width ".Dv O_CLOEXEC"
.It Dv O_RDWR
Open for reading and writing.
.It Dv O_NOCTTY
@@ -79,6 +79,8 @@
.Fn posix_openpt
shall not cause the terminal device to become the controlling terminal
for the process.
+.It Dv O_CLOEXEC
+Set the close-on-exec flag for the new file descriptor.
.El
.Pp
The
@@ -116,6 +118,9 @@
.Fn posix_openpt
function conforms to
.St -p1003.1-2001 .
+The ability to use
+.Dv O_CLOEXEC
+is an extension to the standard.
.Sh HISTORY
The
.Fn posix_openpt
Modified: trunk/sys/kern/tty_pts.c
===================================================================
--- trunk/sys/kern/tty_pts.c 2017-03-04 22:52:29 UTC (rev 9421)
+++ trunk/sys/kern/tty_pts.c 2017-03-04 22:53:07 UTC (rev 9422)
@@ -825,10 +825,10 @@
* POSIX states it's unspecified when other flags are passed. We
* don't allow this.
*/
- if (uap->flags & ~(O_RDWR|O_NOCTTY))
+ if (uap->flags & ~(O_RDWR|O_NOCTTY|O_CLOEXEC))
return (EINVAL);
- error = falloc(td, &fp, &fd, 0);
+ error = falloc(td, &fp, &fd, uap->flags);
if (error)
return (error);
More information about the Midnightbsd-cvs
mailing list