qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
* [PATCH 4/5] haiku build fix
@ 2020-06-26 10:07 David CARLIER
  2020-06-26 11:11 ` Peter Maydell
  0 siblings, 1 reply; 3+ messages in thread
From: David CARLIER @ 2020-06-26 10:07 UTC (permalink / raw)
  To: QEMU Trivial, qemu-devel

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(+)

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].  */
--
2.26.0


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

* Re: [PATCH 4/5] haiku build fix
  2020-06-26 10:07 [PATCH 4/5] haiku build fix David CARLIER
@ 2020-06-26 11:11 ` Peter Maydell
  0 siblings, 0 replies; 3+ messages in thread
From: Peter Maydell @ 2020-06-26 11:11 UTC (permalink / raw)
  To: David CARLIER; +Cc: QEMU Trivial, qemu-devel

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


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

* [PATCH 4/5] haiku build fix
@ 2020-06-26 12:53 David CARLIER
  0 siblings, 0 replies; 3+ messages in thread
From: David CARLIER @ 2020-06-26 12:53 UTC (permalink / raw)
  To: QEMU Trivial, qemu-devel

From a4dfa918e6eea7a5ccc4375d83d1f0162e3bb122 Mon Sep 17 00:00:00 2001
From: David Carlier <devnexen@gmail.com>
Date: Fri, 26 Jun 2020 13:43:59 +0000
Subject: [PATCH 1/3] check sys/signal.h presence

Signed-off-by: David Carlier <devnexen@gmail.com>
---
 configure                   | 8 ++++++++
 hw/xen/xen-legacy-backend.c | 1 -
 include/qemu/osdep.h        | 2 +-
 util/oslib-posix.c          | 1 -
 4 files changed, 9 insertions(+), 3 deletions(-)

diff --git a/configure b/configure
index ba88fd1824..5101fd79fd 100755
--- a/configure
+++ b/configure
@@ -3181,6 +3181,11 @@ if ! check_include "ifaddrs.h" ; then
   have_ifaddrs_h=no
 fi

+have_sys_signal_h=no
+if check_include "sys/signal.h" ; then
+  have_sys_signal_h=yes
+fi
+
 ##########################################
 # VTE probe

@@ -7286,6 +7291,9 @@ fi
 if test "$have_broken_size_max" = "yes" ; then
     echo "HAVE_BROKEN_SIZE_MAX=y" >> $config_host_mak
 fi
+if test "$have_sys_signal_h" = "yes" ; then
+    echo "CONFIG_SYS_SIGNAL=y" >> $config_host_mak
+fi

 # Work around a system header bug with some kernel/XFS header
 # versions where they both try to define 'struct fsxattr':
diff --git a/hw/xen/xen-legacy-backend.c b/hw/xen/xen-legacy-backend.c
index 2335ee2e65..92f08fca29 100644
--- a/hw/xen/xen-legacy-backend.c
+++ b/hw/xen/xen-legacy-backend.c
@@ -23,7 +23,6 @@
  */

 #include "qemu/osdep.h"
-#include <sys/signal.h>

 #include "hw/sysbus.h"
 #include "hw/boards.h"
diff --git a/include/qemu/osdep.h b/include/qemu/osdep.h
index ff7c17b857..f88fe23936 100644
--- a/include/qemu/osdep.h
+++ b/include/qemu/osdep.h
@@ -104,7 +104,7 @@ extern int daemon(int, int);
 #include <setjmp.h>
 #include <signal.h>

-#ifdef __OpenBSD__
+#ifdef CONFIG_SYS_SIGNAL
 #include <sys/signal.h>
 #endif

diff --git a/util/oslib-posix.c b/util/oslib-posix.c
index 39ddc77c85..7ad9195c44 100644
--- a/util/oslib-posix.c
+++ b/util/oslib-posix.c
@@ -38,7 +38,6 @@
 #include "qemu/sockets.h"
 #include "qemu/thread.h"
 #include <libgen.h>
-#include <sys/signal.h>
 #include "qemu/cutils.h"

 #ifdef CONFIG_LINUX
-- 
2.26.0


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

end of thread, other threads:[~2020-06-26 12:54 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2020-06-26 10:07 [PATCH 4/5] haiku build fix David CARLIER
2020-06-26 11:11 ` Peter Maydell
  -- strict thread matches above, loose matches on Subject: below --
2020-06-26 12:53 David CARLIER

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).