Source-Changes-HG archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
[src/trunk]: src/sys/compat/linux/arch/alpha add the "special" pipe2.
details: https://anonhg.NetBSD.org/src/rev/a045103b75df
branches: trunk
changeset: 764199:a045103b75df
user: christos <christos%NetBSD.org@localhost>
date: Thu Apr 14 01:03:23 2011 +0000
description:
add the "special" pipe2.
diffstat:
sys/compat/linux/arch/alpha/linux_pipe.c | 43 +++++++++++++++++++++++++++++--
1 files changed, 40 insertions(+), 3 deletions(-)
diffs (79 lines):
diff -r 9aaa7b1fd1d1 -r a045103b75df sys/compat/linux/arch/alpha/linux_pipe.c
--- a/sys/compat/linux/arch/alpha/linux_pipe.c Thu Apr 14 00:59:06 2011 +0000
+++ b/sys/compat/linux/arch/alpha/linux_pipe.c Thu Apr 14 01:03:23 2011 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: linux_pipe.c,v 1.13 2008/04/28 20:23:42 martin Exp $ */
+/* $NetBSD: linux_pipe.c,v 1.14 2011/04/14 01:03:23 christos Exp $ */
/*-
* Copyright (c) 1998 The NetBSD Foundation, Inc.
@@ -30,7 +30,7 @@
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: linux_pipe.c,v 1.13 2008/04/28 20:23:42 martin Exp $");
+__KERNEL_RCSID(0, "$NetBSD: linux_pipe.c,v 1.14 2011/04/14 01:03:23 christos Exp $");
#include <sys/param.h>
#include <sys/systm.h>
@@ -40,12 +40,15 @@
#include <sys/mman.h>
#include <sys/mount.h>
#include <sys/proc.h>
+#include <sys/filedesc.h>
+#include <sys/fcntl.h>
#include <sys/syscallargs.h>
#include <compat/linux/common/linux_types.h>
#include <compat/linux/common/linux_mmap.h>
#include <compat/linux/common/linux_signal.h>
+#include <compat/linux/common/linux_fcntl.h>
#include <compat/linux/linux_syscallargs.h>
@@ -62,9 +65,43 @@
{
int error;
- if ((error = sys_pipe(l, 0, retval)))
+ if ((error = pipe1(l, retval, 0)))
return error;
(l->l_md.md_tf)->tf_regs[FRAME_A4] = retval[1];
return 0;
}
+
+int
+linux_sys_pipe2(struct lwp *l, const linux_sys_pipe2_args *uap,
+ register_t *retval)
+{
+ /* {
+ syscallarg(int *) pfds;
+ syscallarg(int) flags;
+ } */
+ int error;
+ int flag = 0;
+
+ switch (SCARG(uap, flags)) {
+ case LINUX_O_CLOEXEC:
+ break;
+ case LINUX_O_NONBLOCK:
+ case LINUX_O_NONBLOCK|LINUX_O_CLOEXEC:
+ flag = O_NONBLOCK;
+ break;
+ default:
+ return EINVAL;
+ }
+
+ if ((error = pipe1(l, retval, flag)))
+ return error;
+
+ (l->l_md.md_tf)->tf_regs[FRAME_A4] = retval[1];
+
+ if (SCARG(uap, flags) & LINUX_O_CLOEXEC) {
+ fd_set_exclose(l, retval[0], true);
+ fd_set_exclose(l, retval[1], true);
+ }
+ return 0;
+}
Home |
Main Index |
Thread Index |
Old Index