From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1Me57V-0008PA-Mg for qemu-devel@nongnu.org; Thu, 20 Aug 2009 06:43:49 -0400 Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1Me57R-0008Mz-N7 for qemu-devel@nongnu.org; Thu, 20 Aug 2009 06:43:49 -0400 Received: from [199.232.76.173] (port=48625 helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1Me57R-0008MW-E3 for qemu-devel@nongnu.org; Thu, 20 Aug 2009 06:43:45 -0400 Received: from cantor2.suse.de ([195.135.220.15]:50540 helo=mx2.suse.de) by monty-python.gnu.org with esmtp (Exim 4.60) (envelope-from ) id 1Me57Q-0003UO-Ng for qemu-devel@nongnu.org; Thu, 20 Aug 2009 06:43:45 -0400 From: Ulrich Hecht Date: Thu, 20 Aug 2009 12:43:41 +0200 Message-Id: <1250765021-9297-1-git-send-email-uli@suse.de> In-Reply-To: <1248965155-14108-1-git-send-email-uli@suse.de> References: <1248965155-14108-1-git-send-email-uli@suse.de> Subject: [Qemu-devel] [PATCH 07/13] linux-user: dup3, fallocate syscalls List-Id: qemu-devel.nongnu.org List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: qemu-devel@nongnu.org, Riku Voipio implementations of dup3 and fallocate that are good enough to fool LTP dup3 check, fallocate check fixed use compile_prog Signed-off-by: Ulrich Hecht --- configure | 36 ++++++++++++++++++++++++++++++++++++ linux-user/syscall.c | 10 ++++++++++ 2 files changed, 46 insertions(+), 0 deletions(-) diff --git a/configure b/configure index 8e109c5..45f7a52 100755 --- a/configure +++ b/configure @@ -1349,6 +1349,36 @@ if compile_prog "" "" ; then splice=yes fi +# check for fallocate +fallocate=no +cat > $TMPC << EOF +#include + +int main(void) +{ + fallocate(0, 0, 0, 0); + return 0; +} +EOF +if compile_prog "" "" ; then + fallocate=yes +fi + +# check for dup3 +dup3=no +cat > $TMPC << EOF +#include + +int main(void) +{ + dup3(0, 0, 0); + return 0; +} +EOF +if compile_prog "" "" ; 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" @@ -1688,6 +1718,12 @@ fi if test "$splice" = "yes" ; then echo "CONFIG_SPLICE=y" >> $config_host_mak fi +if test "$fallocate" = "yes" ; then + 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 "CONFIG_INOTIFY=y" >> $config_host_mak fi diff --git a/linux-user/syscall.c b/linux-user/syscall.c index 6712cb7..7ee66bf 100644 --- a/linux-user/syscall.c +++ b/linux-user/syscall.c @@ -4731,6 +4731,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(TARGET_NR_dup3) && defined(CONFIG_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()); @@ -6983,6 +6988,11 @@ abi_long do_syscall(void *cpu_env, int num, abi_long arg1, break; #endif #endif /* CONFIG_SPLICE */ +#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