@@ -0,0 +1,72 @@
+diff --git a/configure b/configure
+index 68a18f5..917dfd8 100755
+--- a/configure
++++ b/configure
+@@ -1386,6 +1386,40 @@ if $cc $ARCH_CFLAGS -o $TMPE $TMPC 2> /dev/null ; then
+ fallocate=yes
+ fi
+
++# check for fallocate64
++cat > $TMPC << EOF
++#include <fcntl.h>
++
++int main(void)
++{
++ fallocate64(0, 0, 0, 0);
++ return 0;
++}
++EOF
++if $cc $ARCH_CFLAGS -o $TMPE $TMPC 2> /dev/null ; then
++ fallocate=yes
++else
++ fallocate=no
++fi
++
++# check for dup3
++dup3avail=no
++cat > $TMPC << EOF
++#include <fcntl.h>
++
++int main(void)
++{
++ dup3(0, 0, 0);
++ return 0;
++}
++EOF
++if $cc $ARCH_CFLAGS -o $TMPE $TMPC 2> /dev/null ; then
++ dup3avail=yes
++fi
++
++echo "fallocate = $fallocate"
++echo "dup3avail = $dup3avail"
++
+ # 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"
+diff --git a/linux-user/syscall.c b/linux-user/syscall.c
+index 41a67aa..0c9bdb4 100644
+--- a/linux-user/syscall.c
++++ b/linux-user/syscall.c
+@@ -3679,8 +3679,10 @@ static int target_to_host_fcntl_cmd(int cmd)
+ return F_SETLEASE;
+ case TARGET_F_GETLEASE:
+ return F_GETLEASE;
++#if defined(CONFIG_DUP3AVAIL)
+ case TARGET_F_DUPFD_CLOEXEC:
+ return F_DUPFD_CLOEXEC;
++#endif
+ case TARGET_F_NOTIFY:
+ return F_NOTIFY;
+ default:
+@@ -4730,6 +4732,11 @@ abi_long do_syscall(void *cpu_env, int num, abi_long arg1,
+ case TARGET_NR_dup2:
+ ret = get_errno(dup2(arg1, arg2));
+ break;
++#if defined(CONFIG_DUP3AVAIL) && defined(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());
|