From: "Kirill A. Shutemov" <kirill@shutemov.name>
To: qemu-devel@nongnu.org
Cc: "Kirill A. Shutemov" <kirill@shutemov.name>,
Robert Reif <reif@earthlink.net>
Subject: [Qemu-devel] [PATCH, v2] Fix building with glibc < 2.4
Date: Wed, 10 Dec 2008 14:14:27 +0200 [thread overview]
Message-ID: <1228911267-21085-1-git-send-email-kirill@shutemov.name> (raw)
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 <kirill@shutemov.name>
Signed-off-by: Robert Reif <reif@earthlink.net>
---
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 <unistd.h>
#include <errno.h>
#include <sys/mman.h>
+#include <linux/mman.h>
+#include <linux/unistd.h>
#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
reply other threads:[~2008-12-10 12:12 UTC|newest]
Thread overview: [no followups] expand[flat|nested] mbox.gz Atom feed
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1228911267-21085-1-git-send-email-kirill@shutemov.name \
--to=kirill@shutemov.name \
--cc=qemu-devel@nongnu.org \
--cc=reif@earthlink.net \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).