diff mbox series

[4/5] haiku build fix

Message ID CA+XhMqzFX3_kNmrLeuk7TCn9MQ5wwe-wWdDdWsGPBViuiHRAAg@mail.gmail.com
State New
Headers show
Series [1/5] haiku build fix | expand

Commit Message

David Carlier June 26, 2020, 10:07 a.m. UTC
From 775173ded5657de4d4b467f2f68e747f6a9c0750 Mon Sep 17 00:00:00 2001
From: David Carlier <devnexen@gmail.com>
Date: Fri, 26 Jun 2020 10:44:36 +0000
Subject: [PATCH 4/5] Platform specific changes qemu_exec_dir implementation

Signed-off-by: David Carlier <devnexen@gmail.com>
---
 include/qemu/osdep.h |  4 ++++
 util/oslib-posix.c   | 20 ++++++++++++++++++++
 2 files changed, 24 insertions(+)

--
2.26.0

Comments

Peter Maydell June 26, 2020, 11:11 a.m. UTC | #1
On Fri, 26 Jun 2020 at 11:09, David CARLIER <devnexen@gmail.com> wrote:
>
> From 775173ded5657de4d4b467f2f68e747f6a9c0750 Mon Sep 17 00:00:00 2001
> From: David Carlier <devnexen@gmail.com>
> Date: Fri, 26 Jun 2020 10:44:36 +0000
> Subject: [PATCH 4/5] Platform specific changes qemu_exec_dir implementation

If you could provide more detailed commit messages that
would be helpful (mostly it will save me having to expand
them myself when I apply the patches :-)).

> Signed-off-by: David Carlier <devnexen@gmail.com>
> ---
>  include/qemu/osdep.h |  4 ++++
>  util/oslib-posix.c   | 20 ++++++++++++++++++++
>  2 files changed, 24 insertions(+)
>
> diff --git a/include/qemu/osdep.h b/include/qemu/osdep.h
> index ff7c17b857..da970cf654 100644
> --- a/include/qemu/osdep.h
> +++ b/include/qemu/osdep.h
> @@ -388,6 +388,10 @@ void qemu_anon_ram_free(void *ptr, size_t size);
>  #define HAVE_CHARDEV_PARPORT 1
>  #endif
>
> +#if defined(__HAIKU__)
> +#define SIGIO SIGPOLL
> +#endif

This isn't part of the qemu_exec_dir change, so it
shouldn't be in this patch.

> +
>  #if defined(CONFIG_LINUX)
>  #ifndef BUS_MCEERR_AR
>  #define BUS_MCEERR_AR 4
> diff --git a/util/oslib-posix.c b/util/oslib-posix.c
> index 39ddc77c85..ff36fa41ff 100644
> --- a/util/oslib-posix.c
> +++ b/util/oslib-posix.c
> @@ -38,7 +38,12 @@
>  #include "qemu/sockets.h"
>  #include "qemu/thread.h"
>  #include <libgen.h>
> +#if !defined __HAIKU__
>  #include <sys/signal.h>
> +#else
> +#include <kernel/image.h>
> +#include <signal.h>
> +#endif

osdep.h already includes signal.h, so you shouldn't need
to include it here. Looking at osdep.h it already includes
sys/signal.h for OpenBSD, so I think the right answer is:

In one patch:
 * have configure check whether sys/signal.h exists
 * change the "#ifdef __OpenBSD__" guard on including
   sys/signal.h in osdep.h to check CONFIG_SYS_SIGNAL instead
 * remove the #include of <sys/signal.h> from util/oslib-posix.c
   and hw/xen/xen-legacy-backend.c

In another patch:
 * have the workaround in osdep.h for Haiku not providing SIGIO

In a third patch:
 * have the new qemu_init_exec_dir() implementation (which
   should now only need to add kernel/image.h to the #includes
   in oslib-posix.c and not also change the signal related includes)

>  #include "qemu/cutils.h"
>
>  #ifdef CONFIG_LINUX
> @@ -390,6 +395,21 @@ void qemu_init_exec_dir(const char *argv0)
>              }
>          }
>      }
> +#elif defined(__HAIKU__)
> +    {
> +        image_info ii;
> +        int32_t c = 0;
> +
> +        *buf = '\0';
> +        while (get_next_image_info(0, &c, &ii) == B_OK) {
> +            if (ii.type == B_APP_IMAGE) {
> +                strncpy(buf, ii.name, sizeof(buf));
> +                buf[sizeof(buf) - 1] = '\0';
> +                p = buf;
> +                break;
> +            }
> +        }
> +    }
>  #endif
>      /* If we don't have any way of figuring out the actual executable
>         location then try argv[0].  */

thanks
-- PMM
diff mbox series

Patch

diff --git a/include/qemu/osdep.h b/include/qemu/osdep.h
index ff7c17b857..da970cf654 100644
--- a/include/qemu/osdep.h
+++ b/include/qemu/osdep.h
@@ -388,6 +388,10 @@  void qemu_anon_ram_free(void *ptr, size_t size);
 #define HAVE_CHARDEV_PARPORT 1
 #endif

+#if defined(__HAIKU__)
+#define SIGIO SIGPOLL
+#endif
+
 #if defined(CONFIG_LINUX)
 #ifndef BUS_MCEERR_AR
 #define BUS_MCEERR_AR 4
diff --git a/util/oslib-posix.c b/util/oslib-posix.c
index 39ddc77c85..ff36fa41ff 100644
--- a/util/oslib-posix.c
+++ b/util/oslib-posix.c
@@ -38,7 +38,12 @@ 
 #include "qemu/sockets.h"
 #include "qemu/thread.h"
 #include <libgen.h>
+#if !defined __HAIKU__
 #include <sys/signal.h>
+#else
+#include <kernel/image.h>
+#include <signal.h>
+#endif
 #include "qemu/cutils.h"

 #ifdef CONFIG_LINUX
@@ -390,6 +395,21 @@  void qemu_init_exec_dir(const char *argv0)
             }
         }
     }
+#elif defined(__HAIKU__)
+    {
+        image_info ii;
+        int32_t c = 0;
+
+        *buf = '\0';
+        while (get_next_image_info(0, &c, &ii) == B_OK) {
+            if (ii.type == B_APP_IMAGE) {
+                strncpy(buf, ii.name, sizeof(buf));
+                buf[sizeof(buf) - 1] = '\0';
+                p = buf;
+                break;
+            }
+        }
+    }
 #endif
     /* If we don't have any way of figuring out the actual executable
        location then try argv[0].  */