Author: jilles
Date: Thu Mar 21 21:39:15 2013
New Revision: 248593
URL: http://svnweb.freebsd.org/changeset/base/248593

Log:
  Allow O_CLOEXEC in posix_openpt() flags.
  
  PR:           kern/162374
  Reviewed by:  ed

Modified:
  head/lib/libc/sys/posix_openpt.2
  head/sys/kern/tty_pts.c

Modified: head/lib/libc/sys/posix_openpt.2
==============================================================================
--- head/lib/libc/sys/posix_openpt.2    Thu Mar 21 20:14:51 2013        
(r248592)
+++ head/lib/libc/sys/posix_openpt.2    Thu Mar 21 21:39:15 2013        
(r248593)
@@ -37,7 +37,7 @@
 .\"
 .\" $FreeBSD$
 .\"
-.Dd August 20, 2008
+.Dd March 21, 2013
 .Dt POSIX_OPENPT 2
 .Os
 .Sh NAME
@@ -71,7 +71,7 @@ Values for
 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 @@ If set
 .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 @@ The
 .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: head/sys/kern/tty_pts.c
==============================================================================
--- head/sys/kern/tty_pts.c     Thu Mar 21 20:14:51 2013        (r248592)
+++ head/sys/kern/tty_pts.c     Thu Mar 21 21:39:15 2013        (r248593)
@@ -825,10 +825,10 @@ sys_posix_openpt(struct thread *td, stru
         * 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);
 
_______________________________________________
svn-src-head@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"

Reply via email to