From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1LANhd-0007mZ-7h for qemu-devel@nongnu.org; Wed, 10 Dec 2008 06:58:05 -0500 Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1LANhZ-0007m1-MT for qemu-devel@nongnu.org; Wed, 10 Dec 2008 06:58:03 -0500 Received: from [199.232.76.173] (port=60882 helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1LANhZ-0007ly-ID for qemu-devel@nongnu.org; Wed, 10 Dec 2008 06:58:01 -0500 Received: from pop-canoe.atl.sa.earthlink.net ([207.69.195.66]:56997) by monty-python.gnu.org with esmtp (Exim 4.60) (envelope-from ) id 1LANhZ-00080Q-6D for qemu-devel@nongnu.org; Wed, 10 Dec 2008 06:58:01 -0500 Message-ID: <493FAEC6.5090807@earthlink.net> Date: Wed, 10 Dec 2008 06:57:58 -0500 From: Robert Reif MIME-Version: 1.0 Subject: Re: [Qemu-devel] [PATCH] Fix building with glibc < 2.4 References: <1228909551-19264-1-git-send-email-kirill@shutemov.name> In-Reply-To: <1228909551-19264-1-git-send-email-kirill@shutemov.name> Content-Type: multipart/mixed; boundary="------------000206050106060407040401" 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" This is a multi-part message in MIME format. --------------000206050106060407040401 Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit Kirill A. Shutemov wrote: > 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 > --- > linux-user/mmap.c | 10 +++++++--- > 1 files changed, 7 insertions(+), 3 deletions(-) > > diff --git a/linux-user/mmap.c b/linux-user/mmap.c > index 89254ae..b6dd184 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" > @@ -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 */ > This version compiles for me. --------------000206050106060407040401 Content-Type: text/plain; name="mremap.diff.txt" Content-Transfer-Encoding: 7bit Content-Disposition: inline; filename="mremap.diff.txt" Index: linux-user/mmap.c =================================================================== --- linux-user/mmap.c (revision 5961) +++ linux-user/mmap.c (working copy) @@ -24,6 +24,8 @@ #include #include #include +#include +#include #include "qemu.h" #include "qemu-common.h" @@ -547,8 +549,8 @@ 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; @@ -557,9 +559,11 @@ 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 */ --------------000206050106060407040401--