All of lore.kernel.org
 help / color / mirror / Atom feed
From: Christoph Egger <Christoph.Egger@amd.com>
To: xen-devel@lists.xensource.com
Subject: [PATCH][IOEMU] build fix for BSD
Date: Mon, 10 Nov 2008 12:29:32 +0200	[thread overview]
Message-ID: <200811101129.32205.Christoph.Egger@amd.com> (raw)

[-- Attachment #1: Type: text/plain, Size: 667 bytes --]


Hi!

Attached patch makes git-ioemu compile on NetBSD.

Signed-off-by: Christoph Egger <Christoph.Egger@amd.com>

P.S.: I'm about sending the pieces to qemu-devel. The changes
in vl.c already went upstream in qemu's svn c/s 5646.


-- 
AMD Saxony, Dresden, Germany
Operating System Research Center

Legal Information:
AMD Saxony Limited Liability Company & Co. KG
Sitz (Geschäftsanschrift):
   Wilschdorfer Landstr. 101, 01109 Dresden, Deutschland
Registergericht Dresden: HRA 4896
vertretungsberechtigter Komplementär:
   AMD Saxony LLC (Sitz Wilmington, Delaware, USA)
Geschäftsführer der AMD Saxony LLC:
   Dr. Hans-R. Deppe, Thomas McCoy

[-- Attachment #2: xen_ioemu_bsd.diff --]
[-- Type: text/x-diff, Size: 3404 bytes --]

diff --git a/block.c b/block.c
index b83e633..a90cfa8 100644
--- a/block.c
+++ b/block.c
@@ -32,8 +32,10 @@
 #include <sys/stat.h>
 #include <sys/ioctl.h>
 #include <sys/queue.h>
+#if defined(__FreeBSD__)
 #include <sys/disk.h>
 #endif
+#endif
 
 #define SECTOR_BITS 9
 #define SECTOR_SIZE (1 << SECTOR_BITS)
diff --git a/configure b/configure
index 994a4c8..8ad66dc 100755
--- a/configure
+++ b/configure
@@ -341,10 +341,10 @@ for opt do
   esac
 done
 
-if [ "$bsd" = "yes" ] ; then
-    AIOLIBS="-lrt"
-elif [ "$darwin" = "yes" -o "$mingw32" = "yes" ] ; then
+if [ "$darwin" = "yes" -o "$mingw32" = "yes" ] ; then
     AIOLIBS=
+elif [ "$bsd" = "yes" ]; then
+    AIOLIBS="-lrt -lpthread"
 else
     # Some Linux architectures (e.g. s390) don't imply -lpthread automatically.
     AIOLIBS="-lrt -lpthread"
diff --git a/hw/battery_mgmt.h b/hw/battery_mgmt.h
index dd60160..4a4ac8e 100644
--- a/hw/battery_mgmt.h
+++ b/hw/battery_mgmt.h
@@ -25,6 +25,9 @@
 #ifdef CONFIG_STUBDOM
 #define CONFIG_NO_BATTERY_MGMT
 #endif
+#ifdef _BSD /* There's no ioperm(), outb(), inb() */
+#define CONFIG_NO_BATTERY_MGMT
+#endif
 
 enum POWER_MGMT_MODE { PM_MODE_NONE = 0, PM_MODE_PT, PM_MODE_NON_PT };
 enum BATTERY_INFO_TYPE { BATT_NONE, BIF, BST };
diff --git a/monitor.c b/monitor.c
index b15a1fa..cc55ccc 100644
--- a/monitor.c
+++ b/monitor.c
@@ -2210,9 +2210,9 @@ static void monitor_handle_command(const char *cmdline)
                     /* format found */
                     p++;
                     count = 1;
-                    if (isdigit(*p)) {
+                    if (isdigit((uint8_t)*p)) {
                         count = 0;
-                        while (isdigit(*p)) {
+                        while (isdigit((uint8_t)*p)) {
                             count = count * 10 + (*p - '0');
                             p++;
                         }
diff --git a/vl.c b/vl.c
index 182346a..d2833b1 100644
--- a/vl.c
+++ b/vl.c
@@ -56,23 +56,31 @@
 #include <sys/poll.h>
 #include <sys/mman.h>
 #include <sys/ioctl.h>
+#include <sys/resource.h>
 #include <sys/socket.h>
 #include <netinet/in.h>
+#include <net/if.h>
+#if defined(__NetBSD__)
+#include <net/if_tap.h>
+#endif
+#ifdef __linux__
+#include <linux/if_tun.h>
+#endif
+#include <arpa/inet.h>
 #include <dirent.h>
 #include <netdb.h>
 #include <sys/select.h>
-#include <arpa/inet.h>
 #ifdef _BSD
 #include <sys/stat.h>
-#ifndef __APPLE__
+#ifdef __FreeBSD__
 #include <libutil.h>
+#else
+#include <util.h>
 #endif
 #elif defined (__GLIBC__) && defined (__FreeBSD_kernel__)
 #include <freebsd/stdlib.h>
 #else
 #ifdef __linux__
-#include <linux/if.h>
-#include <linux/if_tun.h>
 #include <pty.h>
 #include <malloc.h>
 #include <linux/rtc.h>
@@ -4115,10 +4123,13 @@ static int tap_open(char *ifname, int ifname_size)
 #ifndef TAPGIFNAME
     char *dev;
     struct stat s;
+#else
+    struct ifreq ifr;
 #endif
 
     TFR(fd = open("/dev/tap", O_RDWR));
     if (fd < 0) {
+        fprintf(stderr, "warning: could not open /dev/tap: no virtual network emulation %s\n", strerror(errno));
         return -1;
     }
 
diff --git a/xen-hooks.mak b/xen-hooks.mak
index e874552..8e1b188 100644
--- a/xen-hooks.mak
+++ b/xen-hooks.mak
@@ -19,6 +19,7 @@ CFLAGS += $(CMDLINE_CFLAGS)
 
 LIBS += -L$(XEN_ROOT)/tools/libxc -lxenctrl -lxenguest
 LIBS += -L$(XEN_ROOT)/tools/xenstore -lxenstore
+LIBS += -lossaudio
 
 LDFLAGS := $(CFLAGS) $(LDFLAGS)
 

[-- Attachment #3: Type: text/plain, Size: 138 bytes --]

_______________________________________________
Xen-devel mailing list
Xen-devel@lists.xensource.com
http://lists.xensource.com/xen-devel

             reply	other threads:[~2008-11-10 10:29 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2008-11-10 10:29 Christoph Egger [this message]
2008-11-10 10:49 ` [PATCH][IOEMU] build fix for BSD Keir Fraser
2008-11-10 10:57   ` Christoph Egger
2008-11-10 11:00 ` Stefano Stabellini
2008-11-10 11:02   ` Christoph Egger
2008-11-10 11:08     ` Stefano Stabellini

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=200811101129.32205.Christoph.Egger@amd.com \
    --to=christoph.egger@amd.com \
    --cc=xen-devel@lists.xensource.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.