From owner-svn-src-head@FreeBSD.ORG Thu Mar 21 21:39:15 2013 Return-Path: Delivered-To: svn-src-head@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 D43C93C6; Thu, 21 Mar 2013 21:39:15 +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 C6363CC4; Thu, 21 Mar 2013 21:39:15 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.6/8.14.6) with ESMTP id r2LLdF1O037310; Thu, 21 Mar 2013 21:39:15 GMT (envelope-from jilles@svn.freebsd.org) Received: (from jilles@localhost) by svn.freebsd.org (8.14.6/8.14.5/Submit) id r2LLdFms037308; Thu, 21 Mar 2013 21:39:15 GMT (envelope-from jilles@svn.freebsd.org) Message-Id: <201303212139.r2LLdFms037308@svn.freebsd.org> From: Jilles Tjoelker Date: Thu, 21 Mar 2013 21:39:15 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r248593 - in head: lib/libc/sys sys/kern X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 21 Mar 2013 21:39:15 -0000 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);