virtualization/app-emulation/qemu/files/0.11.0/0026-linux-user-dup3-fallocate-syscalls.patch
2010-02-08 17:17:01 +00:00

81 lines
2.3 KiB
Diff

From ad0b7fcf697651a156c0e4a2911dd9fa69fd011c Mon Sep 17 00:00:00 2001
From: Ulrich Hecht <uli@suse.de>
Date: Thu, 23 Jul 2009 14:33:36 +0200
Subject: [PATCH 26/33] linux-user: dup3, fallocate syscalls
implementations of dup3 and fallocate that are good enough to fool LTP
Signed-off-by: Ulrich Hecht <uli@suse.de>
---
configure | 18 ++++++++++++++++++
linux-user/syscall.c | 10 ++++++++++
2 files changed, 28 insertions(+), 0 deletions(-)
diff --git a/configure b/configure
index e0874b5..4be25f6 100755
--- a/configure
+++ b/configure
@@ -1355,6 +1355,21 @@ if $cc $ARCH_CFLAGS -o $TMPE $TMPC 2> /dev/null ; then
splice=yes
fi
+# check for fallocate
+fallocate=no
+cat > $TMPC << EOF
+#include <fcntl.h>
+
+int main(void)
+{
+ fallocate(0, 0, 0, 0);
+ return 0;
+}
+EOF
+if $cc $ARCH_CFLAGS -o $TMPE $TMPC 2> /dev/null ; then
+ fallocate=yes
+fi
+
# Check if tools are available to build documentation.
if test "$build_docs" = "yes" -a \( ! -x "`which texi2html 2>/dev/null`" -o ! -x "`which pod2man 2>/dev/null`" \) ; then
build_docs="no"
@@ -1707,6 +1722,9 @@ fi
if test "$splice" = "yes" ; then
echo "#define CONFIG_SPLICE 1" >> $config_host_h
fi
+if test "$fallocate" = "yes" ; then
+ echo "#define CONFIG_FALLOCATE 1" >> $config_host_h
+fi
if test "$inotify" = "yes" ; then
echo "#define CONFIG_INOTIFY 1" >> $config_host_h
fi
diff --git a/linux-user/syscall.c b/linux-user/syscall.c
index f7a411d..4fb7998 100644
--- a/linux-user/syscall.c
+++ b/linux-user/syscall.c
@@ -4750,6 +4750,11 @@ abi_long do_syscall(void *cpu_env, int num, abi_long arg1,
case TARGET_NR_dup2:
ret = get_errno(dup2(arg1, arg2));
break;
+#ifdef TARGET_NR_dup3
+ case TARGET_NR_dup3:
+ ret = get_errno(dup3(arg1, arg2, arg3));
+ break;
+#endif
#ifdef TARGET_NR_getppid /* not on alpha */
case TARGET_NR_getppid:
ret = get_errno(getppid());
@@ -7016,6 +7021,11 @@ abi_long do_syscall(void *cpu_env, int num, abi_long arg1,
}
#endif
+#if defined(CONFIG_FALLOCATE) && defined(TARGET_NR_fallocate)
+ case TARGET_NR_fallocate:
+ ret = get_errno(fallocate(arg1, arg2, arg3, arg4));
+ break;
+#endif
default:
unimplemented:
gemu_log("qemu: Unsupported syscall: %d\n", num);
--
1.6.2.1