Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1K1pva-0006vL-Le for qemu-devel@nongnu.org; Thu, 29 May 2008 17:44:54 -0400 Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1K1pvY-0006uX-Mi for qemu-devel@nongnu.org; Thu, 29 May 2008 17:44:53 -0400 Received: from [199.232.76.173] (port=54679 helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1K1pvY-0006uT-EB for qemu-devel@nongnu.org; Thu, 29 May 2008 17:44:52 -0400 Received: from gwyn.kn-bremen.de ([212.63.36.242]:54427) by monty-python.gnu.org with esmtp (Exim 4.60) (envelope-from ) id 1K1pvX-0001T5-WB for qemu-devel@nongnu.org; Thu, 29 May 2008 17:44:52 -0400 Received: from saturn.kn-bremen.de (nox@localhost [127.0.0.1]) by saturn.kn-bremen.de (8.14.2/8.13.8) with ESMTP id m4TLe7I6026353 for ; Thu, 29 May 2008 23:40:07 +0200 (CEST) (envelope-from nox@saturn.kn-bremen.de) Received: (from nox@localhost) by saturn.kn-bremen.de (8.14.2/8.13.6/Submit) id m4TLe7U5026352 for qemu-devel@nongnu.org; Thu, 29 May 2008 23:40:07 +0200 (CEST) (envelope-from nox) From: Juergen Lock Date: Thu, 29 May 2008 23:40:07 +0200 Message-ID: <20080529214007.GA26341@saturn.kn-bremen.de> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Subject: [Qemu-devel] osdep.c patch (FreeBSD hosts) Reply-To: qemu-devel@nongnu.org List-Id: qemu-devel.nongnu.org List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: qemu-devel@nongnu.org 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 +#endif #include #include @@ -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);