Skip to contentSkip to conversation

build fix for BSD

PATCH In review Christoph Egger 3 participants 6 messages Nov 10, 2008

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 build fix for BSD

Hi!

Attached patch makes git-ioemu compile on NetBSD.

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.

Signature · 12 lines
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
block.c +2 -0
index b83e633..a90cfa8 100644
@@ -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)
configure +3 -3
index 994a4c8..8ad66dc 100755
@@ -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"
hw/battery_mgmt.h +3 -0
index dd60160..4a4ac8e 100644
@@ -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 };
monitor.c +2 -2
index b15a1fa..cc55ccc 100644
@@ -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++;
                         }
vl.c +15 -4
index 182346a..d2833b1 100644
@@ -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;
     }
 
xen-hooks.mak +1 -0
index e874552..8e1b188 100644
@@ -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)
 

_______________________________________________
Xen-devel mailing list
[email protected]
http://lists.xensource.com/xen-devel

#1 lore raw
Quoted 8 lines · Christoph Egger

Hi!

Attached patch makes git-ioemu compile on NetBSD.

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.

The unconditional addition of -lossaudio in xen-hooks.mak doesn't look likely to work for Linux. I think this patch will have to wait until Ian Jackson gets back from vacation in a couple of weeks. He's bound to have an opinion about it.

-- Keir

#2 lore raw
Quoted 7 lines · On Monday 10 November 2008 11:49:02 Keir Fraser wrote:
Quoted 6 lines · Christoph Egger

Hi!

Attached patch makes git-ioemu compile on NetBSD.

Quoted 7 lines
Quoted 2 lines

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.

The unconditional addition of -lossaudio in xen-hooks.mak doesn't look likely to work for Linux. I think this patch will have to wait until Ian Jackson gets back from vacation in a couple of weeks. He's bound to have an opinion about it.

The configure script in qemu simply allows to set a oss_lib variable specifically for each OS. I think, the right way is to pull all changes from upstream qemu which introduce this variable in ioemu.

Christoph

Signature · 12 lines
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
#4 lore raw
Quoted 11 lines · On Monday 10 November 2008 12:00:49 Stefano Stabellini wrote:
Quoted 8 lines · Christoph Egger

Hi!

Attached patch makes git-ioemu compile on NetBSD.

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.

Including <net/if.h> currently breaks the stubdom build.

This header is a standard header.
stubdom needs to be fixed then
(which will also help to compile stubdom on non-Linux systems in the future).

Christoph

Signature · 12 lines
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
#5 lore raw
Quoted 8 lines · Christoph Egger
Quoted 7 lines · On Monday 10 November 2008 12:00:49 Stefano Stabellini wrote:
Quoted 6 lines · Christoph Egger

Hi!

Attached patch makes git-ioemu compile on NetBSD.

Quoted 9 lines
Quoted 3 lines
Quoted 2 lines

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.

Including <net/if.h> currently breaks the stubdom build.

This header is a standard header.
stubdom needs to be fixed then
(which will also help to compile stubdom on non-Linux systems in the future).

Yes, I know.
I'll send a patch in today.