Source-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[src/trunk]: src/sys/compat/linux/common move dup3 to a more appropriate plac...



details:   https://anonhg.NetBSD.org/src/rev/9aaa7b1fd1d1
branches:  trunk
changeset: 764198:9aaa7b1fd1d1
user:      christos <christos%NetBSD.org@localhost>
date:      Thu Apr 14 00:59:06 2011 +0000

description:
move dup3 to a more appropriate place because pipe is "special". Gotta love
linux.

diffstat:

 sys/compat/linux/common/linux_file.c |  24 ++++++++++++++++++++++--
 sys/compat/linux/common/linux_pipe.c |  23 ++---------------------
 2 files changed, 24 insertions(+), 23 deletions(-)

diffs (92 lines):

diff -r a56b343a3b65 -r 9aaa7b1fd1d1 sys/compat/linux/common/linux_file.c
--- a/sys/compat/linux/common/linux_file.c      Thu Apr 14 00:35:35 2011 +0000
+++ b/sys/compat/linux/common/linux_file.c      Thu Apr 14 00:59:06 2011 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: linux_file.c,v 1.102 2011/04/10 15:49:56 christos Exp $        */
+/*     $NetBSD: linux_file.c,v 1.103 2011/04/14 00:59:06 christos Exp $        */
 
 /*-
  * Copyright (c) 1995, 1998, 2008 The NetBSD Foundation, Inc.
@@ -35,13 +35,14 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: linux_file.c,v 1.102 2011/04/10 15:49:56 christos Exp $");
+__KERNEL_RCSID(0, "$NetBSD: linux_file.c,v 1.103 2011/04/14 00:59:06 christos Exp $");
 
 #include <sys/param.h>
 #include <sys/systm.h>
 #include <sys/namei.h>
 #include <sys/proc.h>
 #include <sys/file.h>
+#include <sys/fcntl.h>
 #include <sys/stat.h>
 #include <sys/filedesc.h>
 #include <sys/ioctl.h>
@@ -621,6 +622,25 @@
        return sys_pwrite(l, &pra, retval);
 }
 
+int
+linux_sys_dup3(struct lwp *l, const struct linux_sys_dup3_args *uap,
+    register_t *retval)
+{
+       /* {
+               syscallarg(int) from;
+               syscallarg(int) to;
+               syscallarg(int) flags;
+       } */
+       int error;
+       if ((error = sys_dup2(l, (const struct sys_dup2_args *)uap, retval)))
+               return error;
+
+       if (SCARG(uap, flags) & LINUX_O_CLOEXEC)
+               fd_set_exclose(l, SCARG(uap, to), true);
+
+       return 0;
+}
+
 #define LINUX_NOT_SUPPORTED(fun) \
 int \
 fun(struct lwp *l, const struct fun##_args *uap, register_t *retval) \
diff -r a56b343a3b65 -r 9aaa7b1fd1d1 sys/compat/linux/common/linux_pipe.c
--- a/sys/compat/linux/common/linux_pipe.c      Thu Apr 14 00:35:35 2011 +0000
+++ b/sys/compat/linux/common/linux_pipe.c      Thu Apr 14 00:59:06 2011 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: linux_pipe.c,v 1.64 2011/04/10 15:50:34 christos Exp $ */
+/*     $NetBSD: linux_pipe.c,v 1.65 2011/04/14 00:59:06 christos Exp $ */
 
 /*-
  * Copyright (c) 1995, 1998 The NetBSD Foundation, Inc.
@@ -30,7 +30,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: linux_pipe.c,v 1.64 2011/04/10 15:50:34 christos Exp $");
+__KERNEL_RCSID(0, "$NetBSD: linux_pipe.c,v 1.65 2011/04/14 00:59:06 christos Exp $");
 
 #include <sys/param.h>
 #include <sys/systm.h>
@@ -130,22 +130,3 @@
        return linux_pipe_return(l, SCARG(uap, pfds), retval,
            SCARG(uap, flags));
 }
-
-int
-linux_sys_dup3(struct lwp *l, const struct linux_sys_dup3_args *uap,
-    register_t *retval)
-{
-       /* {
-               syscallarg(int) from;
-               syscallarg(int) to;
-               syscallarg(int) flags;
-       } */
-       int error;
-       if ((error = sys_dup2(l, (const struct sys_dup2_args *)uap, retval)))
-               return error;
-
-       if (SCARG(uap, flags) & LINUX_O_CLOEXEC)
-               fd_set_exclose(l, SCARG(uap, to), true);
-
-       return 0;
-}



Home | Main Index | Thread Index | Old Index