From owner-svn-src-all@freebsd.org Sat Jan 9 15:34:56 2016 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 07350A692B7; Sat, 9 Jan 2016 15:34:56 +0000 (UTC) (envelope-from dchagin@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id D2F8119BE; Sat, 9 Jan 2016 15:34:55 +0000 (UTC) (envelope-from dchagin@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id u09FYssf021477; Sat, 9 Jan 2016 15:34:54 GMT (envelope-from dchagin@FreeBSD.org) Received: (from dchagin@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id u09FYsHY021472; Sat, 9 Jan 2016 15:34:54 GMT (envelope-from dchagin@FreeBSD.org) Message-Id: <201601091534.u09FYsHY021472@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: dchagin set sender to dchagin@FreeBSD.org using -f From: Dmitry Chagin Date: Sat, 9 Jan 2016 15:34:54 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-10@freebsd.org Subject: svn commit: r293508 - in stable/10/sys: amd64/linux32 compat/linux i386/linux X-SVN-Group: stable-10 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.20 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 09 Jan 2016 15:34:56 -0000 Author: dchagin Date: Sat Jan 9 15:34:54 2016 New Revision: 293508 URL: https://svnweb.freebsd.org/changeset/base/293508 Log: MFC r283399: Implement dup3() system call. Modified: stable/10/sys/amd64/linux32/linux32_dummy.c stable/10/sys/amd64/linux32/syscalls.master stable/10/sys/compat/linux/linux_file.c stable/10/sys/i386/linux/linux_dummy.c stable/10/sys/i386/linux/syscalls.master Directory Properties: stable/10/ (props changed) Modified: stable/10/sys/amd64/linux32/linux32_dummy.c ============================================================================== --- stable/10/sys/amd64/linux32/linux32_dummy.c Sat Jan 9 15:33:48 2016 (r293507) +++ stable/10/sys/amd64/linux32/linux32_dummy.c Sat Jan 9 15:34:54 2016 (r293508) @@ -123,7 +123,6 @@ DUMMY(timerfd_gettime); DUMMY(signalfd4); DUMMY(eventfd2); DUMMY(epoll_create1); -DUMMY(dup3); DUMMY(inotify_init1); /* linux 2.6.30: */ DUMMY(preadv); Modified: stable/10/sys/amd64/linux32/syscalls.master ============================================================================== --- stable/10/sys/amd64/linux32/syscalls.master Sat Jan 9 15:33:48 2016 (r293507) +++ stable/10/sys/amd64/linux32/syscalls.master Sat Jan 9 15:34:54 2016 (r293508) @@ -539,7 +539,8 @@ 327 AUE_NULL STD { int linux_signalfd4(void); } 328 AUE_NULL STD { int linux_eventfd2(void); } 329 AUE_NULL STD { int linux_epoll_create1(void); } -330 AUE_NULL STD { int linux_dup3(void); } +330 AUE_NULL STD { int linux_dup3(l_int oldfd, \ + l_int newfd, l_int flags); } 331 AUE_NULL STD { int linux_pipe2(l_int *pipefds, l_int flags); } 332 AUE_NULL STD { int linux_inotify_init1(void); } ; linux 2.6.30: Modified: stable/10/sys/compat/linux/linux_file.c ============================================================================== --- stable/10/sys/compat/linux/linux_file.c Sat Jan 9 15:33:48 2016 (r293507) +++ stable/10/sys/compat/linux/linux_file.c Sat Jan 9 15:34:54 2016 (r293508) @@ -1600,3 +1600,22 @@ linux_pipe2(struct thread *td, struct li /* XXX: Close descriptors on error. */ return (copyout(fildes, args->pipefds, sizeof(fildes))); } + +int +linux_dup3(struct thread *td, struct linux_dup3_args *args) +{ + int cmd; + intptr_t newfd; + + if (args->oldfd == args->newfd) + return (EINVAL); + if ((args->flags & ~LINUX_O_CLOEXEC) != 0) + return (EINVAL); + if (args->flags & LINUX_O_CLOEXEC) + cmd = F_DUP2FD_CLOEXEC; + else + cmd = F_DUP2FD; + + newfd = args->newfd; + return (kern_fcntl(td, args->oldfd, cmd, newfd)); +} Modified: stable/10/sys/i386/linux/linux_dummy.c ============================================================================== --- stable/10/sys/i386/linux/linux_dummy.c Sat Jan 9 15:33:48 2016 (r293507) +++ stable/10/sys/i386/linux/linux_dummy.c Sat Jan 9 15:34:54 2016 (r293508) @@ -119,7 +119,6 @@ DUMMY(timerfd_gettime); DUMMY(signalfd4); DUMMY(eventfd2); DUMMY(epoll_create1); -DUMMY(dup3); DUMMY(inotify_init1); /* linux 2.6.30: */ DUMMY(preadv); Modified: stable/10/sys/i386/linux/syscalls.master ============================================================================== --- stable/10/sys/i386/linux/syscalls.master Sat Jan 9 15:33:48 2016 (r293507) +++ stable/10/sys/i386/linux/syscalls.master Sat Jan 9 15:34:54 2016 (r293508) @@ -547,7 +547,8 @@ 327 AUE_NULL STD { int linux_signalfd4(void); } 328 AUE_NULL STD { int linux_eventfd2(void); } 329 AUE_NULL STD { int linux_epoll_create1(void); } -330 AUE_NULL STD { int linux_dup3(void); } +330 AUE_NULL STD { int linux_dup3(l_int oldfd, \ + l_int newfd, l_int flags); } 331 AUE_NULL STD { int linux_pipe2(l_int *pipefds, l_int flags); } 332 AUE_NULL STD { int linux_inotify_init1(void); } ; linux 2.6.30: