openbsd-ports/emulators/qemu/patches/patch-osdep_c
todd 2feda3c1f5 o update to 0.9.1, lots from brad@
o see http://qemu.org/changelog.html for details
o see README.OpenBSD for an intro to qemu on OpenBSD
o disable broken arm host support for now
2008-04-28 22:52:38 +00:00

51 lines
1.3 KiB
Plaintext

$OpenBSD: patch-osdep_c,v 1.2 2008/04/28 22:52:38 todd Exp $
--- osdep.c.orig Sun Jan 6 14:38:42 2008
+++ osdep.c Tue Apr 1 01:36:02 2008
@@ -83,7 +83,14 @@ void qemu_vfree(void *ptr)
#if defined(USE_KQEMU)
+#ifdef __OpenBSD__
+#include <sys/param.h>
+#include <sys/types.h>
+#include <sys/mount.h>
+#else
#include <sys/vfs.h>
+#endif
+
#include <sys/mman.h>
#include <fcntl.h>
@@ -91,9 +98,15 @@ static void *kqemu_vmalloc(size_t size)
{
static int phys_ram_fd = -1;
static int phys_ram_size = 0;
+ void *ptr;
+
+#ifdef __OpenBSD__ /* no need (?) for a dummy file on OpenBSD */
+ int map_anon = MAP_ANON;
+#else
+ int map_anon = 0;
const char *tmpdir;
char phys_ram_file[1024];
- void *ptr;
+
#ifdef HOST_SOLARIS
struct statvfs stfs;
#else
@@ -155,11 +168,13 @@ static void *kqemu_vmalloc(size_t size)
}
unlink(phys_ram_file);
}
+#endif /* !__OpenBSD__ */
+
size = (size + 4095) & ~4095;
ftruncate(phys_ram_fd, phys_ram_size + size);
ptr = mmap(NULL,
size,
- PROT_WRITE | PROT_READ, MAP_SHARED,
+ PROT_WRITE | PROT_READ, map_anon|MAP_SHARED,
phys_ram_fd, phys_ram_size);
if (ptr == MAP_FAILED) {
fprintf(stderr, "Could not map physical memory\n");