* [Qemu-devel] [PATCH] Fix building with glibc < 2.4
@ 2008-12-10 11:45 Kirill A. Shutemov
2008-12-10 11:57 ` Robert Reif
0 siblings, 1 reply; 3+ messages in thread
From: Kirill A. Shutemov @ 2008-12-10 11:45 UTC (permalink / raw)
To: qemu-devel; +Cc: Kirill A. Shutemov
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>
---
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 <unistd.h>
#include <errno.h>
#include <sys/mman.h>
+#include <linux/mman.h>
+#include <linux/unistd.h>
#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 */
--
1.6.0.2.GIT
^ permalink raw reply related [flat|nested] 3+ messages in thread
* Re: [Qemu-devel] [PATCH] Fix building with glibc < 2.4
2008-12-10 11:45 [Qemu-devel] [PATCH] Fix building with glibc < 2.4 Kirill A. Shutemov
@ 2008-12-10 11:57 ` Robert Reif
2008-12-10 12:07 ` Kirill A. Shutemov
0 siblings, 1 reply; 3+ messages in thread
From: Robert Reif @ 2008-12-10 11:57 UTC (permalink / raw)
To: qemu-devel; +Cc: Kirill A. Shutemov
[-- Attachment #1: Type: text/plain, Size: 1457 bytes --]
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 <kirill@shutemov.name>
> ---
> 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 <unistd.h>
> #include <errno.h>
> #include <sys/mman.h>
> +#include <linux/mman.h>
> +#include <linux/unistd.h>
>
> #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.
[-- Attachment #2: mremap.diff.txt --]
[-- Type: text/plain, Size: 1366 bytes --]
Index: linux-user/mmap.c
===================================================================
--- linux-user/mmap.c (revision 5961)
+++ linux-user/mmap.c (working copy)
@@ -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"
@@ -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 */
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [Qemu-devel] [PATCH] Fix building with glibc < 2.4
2008-12-10 11:57 ` Robert Reif
@ 2008-12-10 12:07 ` Kirill A. Shutemov
0 siblings, 0 replies; 3+ messages in thread
From: Kirill A. Shutemov @ 2008-12-10 12:07 UTC (permalink / raw)
To: Robert Reif; +Cc: qemu-devel
[-- Attachment #1: Type: text/plain, Size: 1795 bytes --]
On Wed, Dec 10, 2008 at 06:57:58AM -0500, Robert Reif wrote:
> 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 <kirill@shutemov.name>
> > ---
> > 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 <unistd.h>
> > #include <errno.h>
> > #include <sys/mman.h>
> > +#include <linux/mman.h>
> > +#include <linux/unistd.h>
> >
> > #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.
Thanks. I'll resend patch with your Sign-off.
--
Regards, Kirill A. Shutemov
+ Belarus, Minsk
+ ALT Linux Team, http://www.altlinux.org/
[-- Attachment #2: Digital signature --]
[-- Type: application/pgp-signature, Size: 197 bytes --]
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2008-12-10 12:05 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2008-12-10 11:45 [Qemu-devel] [PATCH] Fix building with glibc < 2.4 Kirill A. Shutemov
2008-12-10 11:57 ` Robert Reif
2008-12-10 12:07 ` Kirill A. Shutemov
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.