Commit 5f8712aa1eaeb973baf1f52422ef8eb73ccb258a

Authored by blueswir1
1 parent cdba95bd

Use MAP_ANON also for FreeBSD (Juergen Lock)

git-svn-id: svn://svn.savannah.nongnu.org/qemu/trunk@5778 c046a42c-6fe2-441c-8c8c-71466251a162
Showing 1 changed file with 5 additions and 2 deletions
@@ -75,8 +75,10 @@ void qemu_vfree(void *ptr) @@ -75,8 +75,10 @@ void qemu_vfree(void *ptr)
75 #include <sys/types.h> 75 #include <sys/types.h>
76 #include <sys/mount.h> 76 #include <sys/mount.h>
77 #else 77 #else
  78 +#ifndef __FreeBSD__
78 #include <sys/vfs.h> 79 #include <sys/vfs.h>
79 #endif 80 #endif
  81 +#endif
80 82
81 #include <sys/mman.h> 83 #include <sys/mman.h>
82 #include <fcntl.h> 84 #include <fcntl.h>
@@ -87,7 +89,8 @@ static void *kqemu_vmalloc(size_t size) @@ -87,7 +89,8 @@ static void *kqemu_vmalloc(size_t size)
87 static int phys_ram_size = 0; 89 static int phys_ram_size = 0;
88 void *ptr; 90 void *ptr;
89 91
90 -#ifdef __OpenBSD__ /* no need (?) for a dummy file on OpenBSD */ 92 +/* no need (?) for a dummy file on OpenBSD/FreeBSD */
  93 +#if defined(__OpenBSD__) || defined(__FreeBSD__)
91 int map_anon = MAP_ANON; 94 int map_anon = MAP_ANON;
92 #else 95 #else
93 int map_anon = 0; 96 int map_anon = 0;
@@ -154,7 +157,7 @@ static void *kqemu_vmalloc(size_t size) @@ -154,7 +157,7 @@ static void *kqemu_vmalloc(size_t size)
154 } 157 }
155 size = (size + 4095) & ~4095; 158 size = (size + 4095) & ~4095;
156 ftruncate(phys_ram_fd, phys_ram_size + size); 159 ftruncate(phys_ram_fd, phys_ram_size + size);
157 -#endif /* !__OpenBSD__ */ 160 +#endif /* !(__OpenBSD__ || __FreeBSD__) */
158 ptr = mmap(NULL, 161 ptr = mmap(NULL,
159 size, 162 size,
160 PROT_WRITE | PROT_READ, map_anon | MAP_SHARED, 163 PROT_WRITE | PROT_READ, map_anon | MAP_SHARED,