SHA256
1
0
forked from pool/qemu
qemu/0033-dup3-check-fallocate-check-fixed.patch
OBS User autobuild 0185f98d69 Accepting request 1038 from GNOME:Factory
Copy from IBS home:uli_suse:branches:SUSE:Factory:Head/qemu based on submit request 1038 from user uli_suse

OBS-URL: https://build.opensuse.org/request/show/1038
OBS-URL: https://build.opensuse.org/package/show/openSUSE:Factory/qemu?expand=0&rev=31
2009-08-11 15:37:13 +00:00

77 lines
2.2 KiB
Diff

From b54168c6f68c8db62e6c0718b23f637f9804abee Mon Sep 17 00:00:00 2001
From: Ulrich Hecht <uli@suse.de>
Date: Thu, 30 Jul 2009 16:02:52 +0200
Subject: [PATCH 33/33] dup3 check, fallocate check fixed
Signed-off-by: Ulrich Hecht <uli@suse.de>
---
configure | 20 +++++++++++++++++++-
linux-user/syscall.c | 4 +++-
2 files changed, 22 insertions(+), 2 deletions(-)
diff --git a/configure b/configure
index 229f70b..cb4914d 100755
--- a/configure
+++ b/configure
@@ -1370,6 +1370,21 @@ if $cc $ARCH_CFLAGS -o $TMPE $TMPC 2> /dev/null ; then
fallocate=yes
fi
+# check for dup3
+dup3=no
+cat > $TMPC << EOF
+#include <unistd.h>
+
+int main(void)
+{
+ dup3(0, 0, 0);
+ return 0;
+}
+EOF
+if $cc $ARCH_CFLAGS -o $TMPE $TMPC 2> /dev/null ; then
+ dup3=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"
@@ -1723,7 +1738,10 @@ 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
+ echo "CONFIG_FALLOCATE=y" >> $config_host_mak
+fi
+if test "$dup3" = "yes" ; then
+ echo "CONFIG_DUP3=y" >> $config_host_mak
fi
if test "$inotify" = "yes" ; then
echo "#define CONFIG_INOTIFY 1" >> $config_host_h
diff --git a/linux-user/syscall.c b/linux-user/syscall.c
index ef76537..6c109de 100644
--- a/linux-user/syscall.c
+++ b/linux-user/syscall.c
@@ -3707,8 +3707,10 @@ static int target_to_host_fcntl_cmd(int cmd)
return F_SETLEASE;
case TARGET_F_GETLEASE:
return F_GETLEASE;
+#ifdef F_DUPFD_CLOEXEC
case TARGET_F_DUPFD_CLOEXEC:
return F_DUPFD_CLOEXEC;
+#endif
case TARGET_F_NOTIFY:
return F_NOTIFY;
default:
@@ -4758,7 +4760,7 @@ 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
+#if defined(TARGET_NR_dup3) && defined(CONFIG_DUP3)
case TARGET_NR_dup3:
ret = get_errno(dup3(arg1, arg2, arg3));
break;
--
1.6.2.1