qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
* [Qemu-devel] osdep.c patch (FreeBSD hosts)
@ 2008-05-29 21:40 Juergen Lock
  2008-05-29 21:54 ` Fabrice Bellard
  0 siblings, 1 reply; 6+ messages in thread
From: Juergen Lock @ 2008-05-29 21:40 UTC (permalink / raw)
  To: qemu-devel

Hi!

 This is what we use on FreeBSD hosts (re kqemu), maybe it can be
committed to qemu svn:  (also at
	http://www.freebsd.org/cgi/cvsweb.cgi/ports/emulators/qemu/files/patch-osdep.c?rev=1.2;content-type=text%2Fplain
)

Index: qemu/osdep.c
@@ -79,7 +79,9 @@
 
 #if defined(USE_KQEMU)
 
+#ifndef __FreeBSD__
 #include <sys/vfs.h>
+#endif
 #include <sys/mman.h>
 #include <fcntl.h>
 
@@ -90,6 +92,7 @@
     const char *tmpdir;
     char phys_ram_file[1024];
     void *ptr;
+#ifndef __FreeBSD__
 #ifdef HOST_SOLARIS
     struct statvfs stfs;
 #else
@@ -151,12 +154,20 @@
         }
         unlink(phys_ram_file);
     }
+#endif
     size = (size + 4095) & ~4095;
+#ifndef __FreeBSD__
     ftruncate(phys_ram_fd, phys_ram_size + size);
     ptr = mmap(NULL, 
                size, 
                PROT_WRITE | PROT_READ, MAP_SHARED, 
                phys_ram_fd, phys_ram_size);
+#else
+    ptr = mmap(NULL, 
+               size, 
+               PROT_WRITE | PROT_READ, MAP_PRIVATE|MAP_ANON, 
+               -1, 0);
+#endif
     if (ptr == MAP_FAILED) {
         fprintf(stderr, "Could not map physical memory\n");
         exit(1);

^ permalink raw reply	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2008-06-06 19:40 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2008-05-29 21:40 [Qemu-devel] osdep.c patch (FreeBSD hosts) Juergen Lock
2008-05-29 21:54 ` Fabrice Bellard
2008-05-29 22:57   ` Juergen Lock
2008-05-29 23:03     ` Juergen Lock
2008-06-01 13:15       ` Juergen Lock
2008-06-06 19:39         ` Ed Maste

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).