From owner-svn-src-stable-9@FreeBSD.ORG Fri May 24 18:59:45 2013 Return-Path: Delivered-To: svn-src-stable-9@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by hub.freebsd.org (Postfix) with ESMTP id BEDB9D81; Fri, 24 May 2013 18:59:45 +0000 (UTC) (envelope-from jilles@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) by mx1.freebsd.org (Postfix) with ESMTP id 947269DF; Fri, 24 May 2013 18:59:45 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.6/8.14.6) with ESMTP id r4OIxjJu044602; Fri, 24 May 2013 18:59:45 GMT (envelope-from jilles@svn.freebsd.org) Received: (from jilles@localhost) by svn.freebsd.org (8.14.6/8.14.5/Submit) id r4OIxjT7044598; Fri, 24 May 2013 18:59:45 GMT (envelope-from jilles@svn.freebsd.org) Message-Id: <201305241859.r4OIxjT7044598@svn.freebsd.org> From: Jilles Tjoelker Date: Fri, 24 May 2013 18:59:45 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-9@freebsd.org Subject: svn commit: r250973 - in stable/9: lib/libc/sys sys/kern X-SVN-Group: stable-9 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable-9@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: SVN commit messages for only the 9-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 24 May 2013 18:59:45 -0000 Author: jilles Date: Fri May 24 18:59:44 2013 New Revision: 250973 URL: http://svnweb.freebsd.org/changeset/base/250973 Log: MFC r248593: Allow O_CLOEXEC in posix_openpt() flags. PR: kern/162374 Modified: stable/9/lib/libc/sys/posix_openpt.2 stable/9/sys/kern/tty_pts.c Directory Properties: stable/9/lib/libc/ (props changed) stable/9/lib/libc/sys/ (props changed) stable/9/sys/ (props changed) Modified: stable/9/lib/libc/sys/posix_openpt.2 ============================================================================== --- stable/9/lib/libc/sys/posix_openpt.2 Fri May 24 18:54:52 2013 (r250972) +++ stable/9/lib/libc/sys/posix_openpt.2 Fri May 24 18:59:44 2013 (r250973) @@ -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: stable/9/sys/kern/tty_pts.c ============================================================================== --- stable/9/sys/kern/tty_pts.c Fri May 24 18:54:52 2013 (r250972) +++ stable/9/sys/kern/tty_pts.c Fri May 24 18:59:44 2013 (r250973) @@ -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);