Skip to contentSkip to conversation

[5979] Fix compiling without MREMAP_FIXED

Qemu-devel Blue Swirl 2 participants 7 messages Dec 11, 2008 – Dec 15, 2008

lore
Share & tools
lore

Blue Swirl

author
#0 lore raw

Revision: 5979

          http://svn.sv.gnu.org/viewvc/?view=rev&root=qemu&revision=5979
Author:   blueswir1
Date:     2008-12-11 19:12:25 +0000 (Thu, 11 Dec 2008)

Log Message:
-----------
Fix compiling without MREMAP_FIXED

Modified Paths:
--------------
trunk/linux-user/mmap.c

Modified: trunk/linux-user/mmap.c
===================================================================

linux-user/mmap.c +4 -1
@@ -546,6 +546,7 @@
 
     mmap_lock();
 
+#if defined(MREMAP_FIXED)
     if (flags & MREMAP_FIXED)
         host_addr = mremap(g2h(old_addr), old_size, new_size,
                            flags, new_addr);
@@ -560,7 +561,9 @@
         } else
             host_addr = mremap(g2h(old_addr), old_size, new_size,
                                flags | MREMAP_FIXED, g2h(mmap_start));
-    } else {
+    } else
+#endif
+    {
         host_addr = mremap(g2h(old_addr), old_size, new_size, flags);
         /* Check if address fits target address space */
         if ((unsigned long)host_addr + new_size > (abi_ulong)-1) {
#1 lore raw
Quoted 26 lines · Blue Swirl

Revision: 5979

          http://svn.sv.gnu.org/viewvc/?view=rev&root=qemu&revision=5979
Author:   blueswir1
Date:     2008-12-11 19:12:25 +0000 (Thu, 11 Dec 2008)

Log Message:
-----------
Fix compiling without MREMAP_FIXED

Modified Paths:
--------------
trunk/linux-user/mmap.c

Modified: trunk/linux-user/mmap.c
===================================================================

linux-user/mmap.c +1 -0
@@ -546,6 +546,7 @@
 
     mmap_lock();
 
+#if defined(MREMAP_FIXED)
     if (flags & MREMAP_FIXED)
         host_addr = mremap(g2h(old_addr), old_size, new_size,
                            flags, new_addr);

linux-user/mmap.c line 569

Quoted 10 lines
linux-user/mmap.c +3 -1
@@ -560,7 +561,9 @@
         } else
             host_addr = mremap(g2h(old_addr), old_size, new_size,
                                flags | MREMAP_FIXED, g2h(mmap_start));
-    } else {
+    } else
+#endif
+    {
         host_addr = mremap(g2h(old_addr), old_size, new_size, flags);
         /* Check if address fits target address space */
         if ((unsigned long)host_addr + new_size > (abi_ulong)-1) {

I've posted patch that fix building for glibc < 2.4. Please apply my patch instead of it.

Signature · 3 lines
Regards,  Kirill A. Shutemov
 + Belarus, Minsk
 + ALT Linux Team, http://www.altlinux.org/
#2 lore raw
Quoted 32 lines · Kirill A. Shutemov
Quoted 31 lines · Blue Swirl

Revision: 5979

          http://svn.sv.gnu.org/viewvc/?view=rev&root=qemu&revision=5979
Author:   blueswir1
Date:     2008-12-11 19:12:25 +0000 (Thu, 11 Dec 2008)

Log Message:
-----------
Fix compiling without MREMAP_FIXED

Modified Paths:
--------------
trunk/linux-user/mmap.c

Modified: trunk/linux-user/mmap.c
===================================================================

linux-user/mmap.c +2 -1
@@ -546,6 +546,7 @@
 
     mmap_lock();
 
+#if defined(MREMAP_FIXED)
     if (flags & MREMAP_FIXED)
         host_addr = mremap(g2h(old_addr), old_size, new_size,
                            flags, new_addr);
@@ -560,7 +561,9 @@
         } else
             host_addr = mremap(g2h(old_addr), old_size, new_size,
                                flags | MREMAP_FIXED, g2h(mmap_start));
-    } else {
+    } else
Quoted 8 lines

linux-user/mmap.c line 569

Quoted 5 lines
linux-user/mmap.c +2 -0
+#endif
+    {
         host_addr = mremap(g2h(old_addr), old_size, new_size, flags);
         /* Check if address fits target address space */
         if ((unsigned long)host_addr + new_size > (abi_ulong)-1) {

I've posted patch that fix building for glibc < 2.4. Please apply my patch instead of it.

ping.

Signature · 3 lines
Regards,  Kirill A. Shutemov
 + Belarus, Minsk
 + ALT Linux Team, http://www.altlinux.org/
author
#3 lore raw
In reply to Kirill A. Shutemov
Quoted 33 lines · Kirill A. Shutemov
Quoted 32 lines · Blue Swirl

Revision: 5979

          http://svn.sv.gnu.org/viewvc/?view=rev&root=qemu&revision=5979
Author:   blueswir1
Date:     2008-12-11 19:12:25 +0000 (Thu, 11 Dec 2008)

Log Message:
-----------
Fix compiling without MREMAP_FIXED

Modified Paths:
--------------
trunk/linux-user/mmap.c

Modified: trunk/linux-user/mmap.c
===================================================================

linux-user/mmap.c 2008-12-11 19:12:25 UTC (rev 5979) renamed from linux-user/mmap.c 2008-12-11 17:30:50 UTC (rev 5978) +3 -1
@@ -546,6 +546,7 @@
 
     mmap_lock();
 
+#if defined(MREMAP_FIXED)
     if (flags & MREMAP_FIXED)
         host_addr = mremap(g2h(old_addr), old_size, new_size,
                            flags, new_addr);
@@ -560,7 +561,9 @@
         } else
             host_addr = mremap(g2h(old_addr), old_size, new_size,
                                flags | MREMAP_FIXED, g2h(mmap_start));
-    } else {
+    } else
+#endif
Quoted 8 lines

linux-user/mmap.c 2008-12-11 19:12:25 UTC (rev 5979) line 569

Quoted 4 lines
linux-user/mmap.c 2008-12-11 19:12:25 UTC (rev 5979) renamed from linux-user/mmap.c 2008-12-11 17:30:50 UTC (rev 5978) +1 -0
+    {
         host_addr = mremap(g2h(old_addr), old_size, new_size, flags);
         /* Check if address fits target address space */
         if ((unsigned long)host_addr + new_size > (abi_ulong)-1) {

I've posted patch that fix building for glibc < 2.4. Please apply my
patch instead of it.

Your fix depends on linux headers, is that safe?

#4 lore raw
Quoted 40 lines · Blue Swirl
Quoted 39 lines · Kirill A. Shutemov
Quoted 36 lines · Blue Swirl

Revision: 5979

          http://svn.sv.gnu.org/viewvc/?view=rev&root=qemu&revision=5979
Author:   blueswir1
Date:     2008-12-11 19:12:25 +0000 (Thu, 11 Dec 2008)

Log Message:
-----------
Fix compiling without MREMAP_FIXED

Modified Paths:
--------------
trunk/linux-user/mmap.c

Modified: trunk/linux-user/mmap.c
===================================================================

linux-user/mmap.c 2008-12-11 19:12:25 UTC (rev 5979) renamed from linux-user/mmap.c 2008-12-11 17:30:50 UTC (rev 5978) +4 -1
@@ -546,6 +546,7 @@
 
     mmap_lock();
 
+#if defined(MREMAP_FIXED)
     if (flags & MREMAP_FIXED)
         host_addr = mremap(g2h(old_addr), old_size, new_size,
                            flags, new_addr);
@@ -560,7 +561,9 @@
         } else
             host_addr = mremap(g2h(old_addr), old_size, new_size,
                                flags | MREMAP_FIXED, g2h(mmap_start));
-    } else {
+    } else
+#endif
+    {
         host_addr = mremap(g2h(old_addr), old_size, new_size, flags);
         /* Check if address fits target address space */
         if ((unsigned long)host_addr + new_size > (abi_ulong)-1) {
Quoted 4 lines
Quoted 2 lines

I've posted patch that fix building for glibc < 2.4. Please apply my
patch instead of it.

Your fix depends on linux headers, is that safe?

Why not? glibc also depends on it.

Signature · 3 lines
Regards,  Kirill A. Shutemov
 + Belarus, Minsk
 + ALT Linux Team, http://www.altlinux.org/
#5 lore raw
Quoted 41 lines · Kirill A. Shutemov
Quoted 40 lines · Blue Swirl
Quoted 39 lines · Kirill A. Shutemov
Quoted 36 lines · Blue Swirl

Revision: 5979

          http://svn.sv.gnu.org/viewvc/?view=rev&root=qemu&revision=5979
Author:   blueswir1
Date:     2008-12-11 19:12:25 +0000 (Thu, 11 Dec 2008)

Log Message:
-----------
Fix compiling without MREMAP_FIXED

Modified Paths:
--------------
trunk/linux-user/mmap.c

Modified: trunk/linux-user/mmap.c
===================================================================

linux-user/mmap.c 2008-12-11 19:12:25 UTC (rev 5979) renamed from linux-user/mmap.c 2008-12-11 17:30:50 UTC (rev 5978) +4 -1
@@ -546,6 +546,7 @@
 
     mmap_lock();
 
+#if defined(MREMAP_FIXED)
     if (flags & MREMAP_FIXED)
         host_addr = mremap(g2h(old_addr), old_size, new_size,
                            flags, new_addr);
@@ -560,7 +561,9 @@
         } else
             host_addr = mremap(g2h(old_addr), old_size, new_size,
                                flags | MREMAP_FIXED, g2h(mmap_start));
-    } else {
+    } else
+#endif
+    {
         host_addr = mremap(g2h(old_addr), old_size, new_size, flags);
         /* Check if address fits target address space */
         if ((unsigned long)host_addr + new_size > (abi_ulong)-1) {
Quoted 6 lines
Quoted 4 lines
Quoted 2 lines

I've posted patch that fix building for glibc < 2.4. Please apply my
patch instead of it.

Your fix depends on linux headers, is that safe?

Why not? glibc also depends on it.

Blue, please commit my patch.

Signature · 3 lines
Regards,  Kirill A. Shutemov
 + Belarus, Minsk
 + ALT Linux Team, http://www.altlinux.org/
author
#6 lore raw
Quoted 45 lines · Kirill A. Shutemov
Quoted 44 lines · Kirill A. Shutemov
Quoted 43 lines · Blue Swirl
Quoted 41 lines · Kirill A. Shutemov
Quoted 26 lines · Blue Swirl

Revision: 5979

          http://svn.sv.gnu.org/viewvc/?view=rev&root=qemu&revision=5979
Author:   blueswir1
Date:     2008-12-11 19:12:25 +0000 (Thu, 11 Dec 2008)

Log Message:
-----------
Fix compiling without MREMAP_FIXED

Modified Paths:
--------------
trunk/linux-user/mmap.c

Modified: trunk/linux-user/mmap.c
===================================================================

linux-user/mmap.c 2008-12-11 19:12:25 UTC (rev 5979) renamed from linux-user/mmap.c 2008-12-11 17:30:50 UTC (rev 5978) +1 -0
@@ -546,6 +546,7 @@
 
     mmap_lock();
 
+#if defined(MREMAP_FIXED)
     if (flags & MREMAP_FIXED)
         host_addr = mremap(g2h(old_addr), old_size, new_size,
                            flags, new_addr);

linux-user/mmap.c 2008-12-11 19:12:25 UTC (rev 5979) line 569

Quoted 10 lines
linux-user/mmap.c 2008-12-11 19:12:25 UTC (rev 5979) renamed from linux-user/mmap.c 2008-12-11 17:30:50 UTC (rev 5978) +3 -1
@@ -560,7 +561,9 @@
         } else
             host_addr = mremap(g2h(old_addr), old_size, new_size,
                                flags | MREMAP_FIXED, g2h(mmap_start));
-    } else {
+    } else
+#endif
+    {
         host_addr = mremap(g2h(old_addr), old_size, new_size, flags);
         /* Check if address fits target address space */
         if ((unsigned long)host_addr + new_size > (abi_ulong)-1) {

I've posted patch that fix building for glibc < 2.4. Please apply my
patch instead of it.

Quoted 6 lines
Quoted 3 lines
Quoted 1 line

Your fix depends on linux headers, is that safe?

Why not? glibc also depends on it.

Blue, please commit my patch.

I committed a fix, but I had to use syscall also for mremap a few lines above. Let's hope no distros remove linux/mmap.h or linux/unistd.h.