From owner-svn-src-stable@FreeBSD.ORG Wed Aug 29 16:42:27 2012 Return-Path: Delivered-To: svn-src-stable@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id 83E2C1065673; Wed, 29 Aug 2012 16:42:27 +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 6E2BB8FC0C; Wed, 29 Aug 2012 16:42:27 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id q7TGgR9K079688; Wed, 29 Aug 2012 16:42:27 GMT (envelope-from kib@svn.freebsd.org) Received: (from kib@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q7TGgRaK079685; Wed, 29 Aug 2012 16:42:27 GMT (envelope-from kib@svn.freebsd.org) Message-Id: <201208291642.q7TGgRaK079685@svn.freebsd.org> From: Konstantin Belousov Date: Wed, 29 Aug 2012 16:42:27 +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: r239861 - in stable/8/sys: kern sys X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 29 Aug 2012 16:42:27 -0000 Author: kib Date: Wed Aug 29 16:42:26 2012 New Revision: 239861 URL: http://svn.freebsd.org/changeset/base/239861 Log: MFC r238834: Add F_DUP2FD_CLOEXEC. PR: standards/169962 Modified: stable/8/sys/kern/kern_descrip.c stable/8/sys/sys/fcntl.h Directory Properties: stable/8/sys/ (props changed) stable/8/sys/kern/ (props changed) stable/8/sys/sys/ (props changed) Modified: stable/8/sys/kern/kern_descrip.c ============================================================================== --- stable/8/sys/kern/kern_descrip.c Wed Aug 29 16:37:48 2012 (r239860) +++ stable/8/sys/kern/kern_descrip.c Wed Aug 29 16:42:26 2012 (r239861) @@ -453,6 +453,12 @@ kern_fcntl(struct thread *td, int fd, in error = do_dup(td, DUP_FIXED, fd, tmp, td->td_retval); break; + case F_DUP2FD_CLOEXEC: + tmp = arg; + error = do_dup(td, DUP_FIXED | DUP_CLOEXEC, fd, tmp, + td->td_retval); + break; + case F_GETFD: FILEDESC_SLOCK(fdp); if ((fp = fdtofp(fd, fdp)) == NULL) { @@ -789,6 +795,8 @@ do_dup(struct thread *td, int flags, int } if (flags & DUP_FIXED && old == new) { *retval = new; + if (flags & DUP_CLOEXEC) + fdp->fd_ofileflags[new] |= UF_EXCLOSE; FILEDESC_XUNLOCK(fdp); return (0); } Modified: stable/8/sys/sys/fcntl.h ============================================================================== --- stable/8/sys/sys/fcntl.h Wed Aug 29 16:37:48 2012 (r239860) +++ stable/8/sys/sys/fcntl.h Wed Aug 29 16:42:26 2012 (r239861) @@ -228,6 +228,9 @@ typedef __pid_t pid_t; #if __BSD_VISIBLE || __POSIX_VISIBLE >= 200809 #define F_DUPFD_CLOEXEC 17 /* Like F_DUPFD, but FD_CLOEXEC is set */ #endif +#if __BSD_VISIBLE +#define F_DUP2FD_CLOEXEC 18 /* Like F_DUP2FD, but FD_CLOEXEC is set */ +#endif /* file descriptor flags (F_GETFD, F_SETFD) */ #define FD_CLOEXEC 1 /* close-on-exec flag */