Skip site navigation (1)Skip section navigation (2)
Date:      Sat, 9 Jan 2016 15:34:54 +0000 (UTC)
From:      Dmitry Chagin <dchagin@FreeBSD.org>
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
Message-ID:  <201601091534.u09FYsHY021472@repo.freebsd.org>

next in thread | raw e-mail | index | archive | help
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:



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201601091534.u09FYsHY021472>