From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1LANv6-0005lR-6G for qemu-devel@nongnu.org; Wed, 10 Dec 2008 07:12:00 -0500 Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1LANv4-0005kb-LL for qemu-devel@nongnu.org; Wed, 10 Dec 2008 07:11:58 -0500 Received: from [199.232.76.173] (port=35679 helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1LANv4-0005kY-Bg for qemu-devel@nongnu.org; Wed, 10 Dec 2008 07:11:58 -0500 Received: from ey-out-1920.google.com ([74.125.78.146]:47037) by monty-python.gnu.org with esmtp (Exim 4.60) (envelope-from ) id 1LANv4-0000uL-53 for qemu-devel@nongnu.org; Wed, 10 Dec 2008 07:11:58 -0500 Received: by ey-out-1920.google.com with SMTP id 4so71835eyk.4 for ; Wed, 10 Dec 2008 04:11:57 -0800 (PST) From: "Kirill A. Shutemov" Date: Wed, 10 Dec 2008 14:14:27 +0200 Message-Id: <1228911267-21085-1-git-send-email-kirill@shutemov.name> Subject: [Qemu-devel] [PATCH, v2] Fix building with glibc < 2.4 Reply-To: qemu-devel@nongnu.org List-Id: qemu-devel.nongnu.org List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: qemu-devel@nongnu.org Cc: "Kirill A. Shutemov" , Robert Reif Prior to version 2.4, glibc did not expose the definition of MREMAP_FIXED, and the prototype for mremap() did not allow for the new_address argument. Tested only with glibc 2.9. Signed-off-by: Kirill A. Shutemov Signed-off-by: Robert Reif --- linux-user/mmap.c | 14 +++++++++----- 1 files changed, 9 insertions(+), 5 deletions(-) diff --git a/linux-user/mmap.c b/linux-user/mmap.c index 89254ae..35753e3 100644 --- a/linux-user/mmap.c +++ b/linux-user/mmap.c @@ -24,6 +24,8 @@ #include #include #include +#include +#include #include "qemu.h" #include "qemu-common.h" @@ -554,8 +556,8 @@ abi_long target_mremap(abi_ulong old_addr, abi_ulong old_size, mmap_lock(); if (flags & MREMAP_FIXED) - host_addr = mremap(g2h(old_addr), old_size, new_size, - flags, new_addr); + host_addr = (void *) syscall(__NR_mremap, g2h(old_addr), + old_size, new_size, flags, new_addr); else if (flags & MREMAP_MAYMOVE) { abi_ulong mmap_start; @@ -564,9 +566,11 @@ abi_long target_mremap(abi_ulong old_addr, abi_ulong old_size, if (mmap_start == -1) { errno = ENOMEM; host_addr = MAP_FAILED; - } else - host_addr = mremap(g2h(old_addr), old_size, new_size, - flags | MREMAP_FIXED, g2h(mmap_start)); + } else { + host_addr = (void *) syscall(__NR_mremap, g2h(old_addr), + old_size, new_size, flags | MREMAP_FIXED, + g2h(mmap_start)); + } } else { host_addr = mremap(g2h(old_addr), old_size, new_size, flags); /* Check if address fits target address space */ -- 1.6.0.2.GIT