$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 +#include +#include +#else #include +#endif + #include #include @@ -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");