Skip to contentSkip to conversation

hw/i386: Fix broken build for non POSIX hosts

PATCH Applied Stefan Weil 2 participants 2 messages Jan 5, 2013

lore
Share & tools
lore
#0 lore raw

PATCH v2 1/1 hw/i386: Fix broken build for non POSIX hosts

pc-testdev.c cannot be compiled with MinGW (and other non POSIX hosts):

CC i386-softmmu/hw/i386/../pc-testdev.o
qemu/hw/i386/../pc-testdev.c:38:22: warning: sys/mman.h: file not found qemu/hw/i386/../pc-testdev.c: In function ‘test_flush_page’:
qemu/hw/i386/../pc-testdev.c:103: warning: implicit declaration of function ‘mprotect’
...

---

v2

This patch replaces my previous patch

hw/i386: Fix broken build for MinGW

Instead of disabling pc-testdev.o for non KVM hosts, this version only excludes the mprotect code for non POSIX hosts. Alex Graf suggested a similar solution.

- Stefan

 hw/pc-testdev.c |    5 +++++
 1 file changed, 5 insertions(+)
hw/pc-testdev.c +5 -0
index 620c86c..1928489 100644
@@ -35,7 +35,10 @@
  * git://git.kernel.org/pub/scm/virt/kvm/kvm-unit-tests.git
 */
 
+#include "config-host.h"
+#if defined(CONFIG_POSIX)
 #include <sys/mman.h>
+#endif
 #include "hw.h"
 #include "qdev.h"
 #include "isa.h"
@@ -100,8 +103,10 @@ static void test_flush_page(void *opaque, hwaddr addr, uint64_t data,
 
     /* We might not be able to get the full page, only mprotect what we actually
        have mapped */
+#if defined(CONFIG_POSIX)
     mprotect(a, page, PROT_NONE);
     mprotect(a, page, PROT_READ|PROT_WRITE);
+#endif
     cpu_physical_memory_unmap(a, page, 0, 0);
 }
 
Signature · 1 line
1.7.10.4
Applied
#1 lore raw

Thanks, applied.

Quoted 56 lines · Stefan Weil

pc-testdev.c cannot be compiled with MinGW (and other non POSIX hosts):

CC i386-softmmu/hw/i386/../pc-testdev.o
qemu/hw/i386/../pc-testdev.c:38:22: warning: sys/mman.h: file not found qemu/hw/i386/../pc-testdev.c: In function ‘test_flush_page’:
qemu/hw/i386/../pc-testdev.c:103: warning: implicit declaration of function ‘mprotect’
...

---

v2

This patch replaces my previous patch

hw/i386: Fix broken build for MinGW

Instead of disabling pc-testdev.o for non KVM hosts, this version only excludes the mprotect code for non POSIX hosts. Alex Graf suggested a similar solution.

- Stefan

 hw/pc-testdev.c |    5 +++++
 1 file changed, 5 insertions(+)
hw/pc-testdev.c +5 -1
index 620c86c..1928489 100644
@@ -35,7 +35,10 @@
  * git://git.kernel.org/pub/scm/virt/kvm/kvm-unit-tests.git
 */
 
+#include "config-host.h"
+#if defined(CONFIG_POSIX)
 #include <sys/mman.h>
+#endif
 #include "hw.h"
 #include "qdev.h"
 #include "isa.h"
@@ -100,8 +103,10 @@ static void test_flush_page(void *opaque, hwaddr addr, uint64_t data,
 
     /* We might not be able to get the full page, only mprotect what we actually
        have mapped */
+#if defined(CONFIG_POSIX)
     mprotect(a, page, PROT_NONE);
     mprotect(a, page, PROT_READ|PROT_WRITE);
+#endif
     cpu_physical_memory_unmap(a, page, 0, 0);
 }
 
--

1.7.10.4