From owner-svn-src-stable-8@FreeBSD.ORG Fri Apr 1 12:52:55 2011 Return-Path: Delivered-To: svn-src-stable-8@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id B18C3106566B; Fri, 1 Apr 2011 12:52:55 +0000 (UTC) (envelope-from kib@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id A0EAE8FC0A; Fri, 1 Apr 2011 12:52:55 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id p31Cqte3045527; Fri, 1 Apr 2011 12:52:55 GMT (envelope-from kib@svn.freebsd.org) Received: (from kib@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id p31CqtoA045525; Fri, 1 Apr 2011 12:52:55 GMT (envelope-from kib@svn.freebsd.org) Message-Id: <201104011252.p31CqtoA045525@svn.freebsd.org> From: Konstantin Belousov Date: Fri, 1 Apr 2011 12:52:55 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-8@freebsd.org X-SVN-Group: stable-8 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r220242 - stable/8/lib/libc/sys X-BeenThere: svn-src-stable-8@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for only the 8-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 01 Apr 2011 12:52:55 -0000 Author: kib Date: Fri Apr 1 12:52:55 2011 New Revision: 220242 URL: http://svn.freebsd.org/changeset/base/220242 Log: MFC r220000: Document O_CLOEXEC. Modified: stable/8/lib/libc/sys/open.2 Directory Properties: stable/8/lib/libc/ (props changed) stable/8/lib/libc/stdtime/ (props changed) Modified: stable/8/lib/libc/sys/open.2 ============================================================================== --- stable/8/lib/libc/sys/open.2 Fri Apr 1 12:50:29 2011 (r220241) +++ stable/8/lib/libc/sys/open.2 Fri Apr 1 12:52:55 2011 (r220242) @@ -28,7 +28,7 @@ .\" @(#)open.2 8.2 (Berkeley) 11/16/93 .\" $FreeBSD$ .\" -.Dd February 28, 2009 +.Dd March 25, 2011 .Dt OPEN 2 .Os .Sh NAME @@ -117,6 +117,7 @@ O_SYNC synchronous writes O_NOFOLLOW do not follow symlinks O_NOCTTY don't assign controlling terminal O_TTY_INIT restore default terminal attributes +O_CLOEXEC set FD_CLOEXEC upon open .Ed .Pp Opening a file with @@ -222,6 +223,11 @@ The initial call to on a TTY will always restore default terminal attributes on .Fx . .Pp +.Dv O_CLOEXEC +may be used to set +.Dv FD_CLOEXEC +flag for the newly returned file descriptor. +.Pp If successful, .Fn open returns a non-negative integer, termed a file descriptor. @@ -232,12 +238,18 @@ file is set to the beginning of the file When a new file is created it is given the group of the directory which contains it. .Pp -The new descriptor is set to remain open across +Unless +.Dv +O_CLOEXEC +flag was specified, +the new descriptor is set to remain open across .Xr execve 2 system calls; see -.Xr close 2 +.Xr close 2 , +.Xr fcntl 2 and -.Xr fcntl 2 . +.Dv O_CLOEXEC +description. .Pp The system imposes a limit on the number of file descriptors open simultaneously by one process.