qemu-trivial
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: build: haiky system build fix


From: Christophe de Dinechin
Subject: Re: build: haiky system build fix
Date: Thu, 16 Jul 2020 00:09:01 +0200

nit: typo in the mail subject (haiky instead of haiku)

> On 25 Jun 2020, at 20:36, David CARLIER <devnexen@gmail.com> wrote:
> 
> From 25adbdcdc17ef51a41759f16576901338ed8a469 Mon Sep 17 00:00:00 2001
> From: David Carlier <devnexen@gmail.com>
> Date: Thu, 25 Jun 2020 19:32:42 +0000
> Subject: [PATCH] build: haiku system build fix
> 
> Most of missing features resides in the bsd library.
> Also defining constant equivalence.
> 
> Signed-off-by: David Carlier <devnexen@gmail.com>
> ---
> configure            |  4 ++--
> include/qemu/bswap.h |  2 ++
> os-posix.c           |  4 ++++
> util/compatfd.c      |  2 ++
> util/drm.c           |  2 ++
> util/main-loop.c     |  3 +++
> util/oslib-posix.c   | 20 ++++++++++++++++++++
> util/qemu-openpty.c  |  2 +-
> 8 files changed, 36 insertions(+), 3 deletions(-)
> 
> diff --git a/configure b/configure
> index ba88fd1824..3732ad4e35 100755
> --- a/configure
> +++ b/configure
> @@ -901,8 +901,8 @@ SunOS)
> ;;
> Haiku)
>   haiku="yes"
> -  QEMU_CFLAGS="-DB_USE_POSITIVE_POSIX_ERRORS $QEMU_CFLAGS"
> -  LIBS="-lposix_error_mapper -lnetwork $LIBS"
> +  QEMU_CFLAGS="-DB_USE_POSITIVE_POSIX_ERRORS -D_BSD_SOURCE $QEMU_CFLAGS"
> +  LIBS="-lposix_error_mapper -lnetwork -lbsd $LIBS"
> ;;
> Linux)
>   audio_drv_list="try-pa oss"
> diff --git a/include/qemu/bswap.h b/include/qemu/bswap.h
> index 2a9f3fe783..1d3e4c24e4 100644
> --- a/include/qemu/bswap.h
> +++ b/include/qemu/bswap.h
> @@ -8,6 +8,8 @@
> # include <machine/bswap.h>
> #elif defined(__FreeBSD__)
> # include <sys/endian.h>
> +#elif defined(__HAIKU__)
> +# include <endian.h>
> #elif defined(CONFIG_BYTESWAP_H)
> # include <byteswap.h>
> 
> diff --git a/os-posix.c b/os-posix.c
> index 3cd52e1e70..ca07b7702d 100644
> --- a/os-posix.c
> +++ b/os-posix.c
> @@ -42,6 +42,8 @@
> #include <sys/prctl.h>
> #endif
> 
> +#include <sys/mman.h>
> +
> /*
>  * Must set all three of these at once.
>  * Legal combinations are              unset   by name   by uid
> @@ -339,10 +341,12 @@ int os_mlock(void)
> {
>     int ret = 0;
> 
> +#if !defined(__HAIKU__)
>     ret = mlockall(MCL_CURRENT | MCL_FUTURE);
>     if (ret < 0) {
>         error_report("mlockall: %s", strerror(errno));
>     }
> 
> +#endif
>     return ret;
> }
> diff --git a/util/compatfd.c b/util/compatfd.c
> index c296f55d14..ee47dd8089 100644
> --- a/util/compatfd.c
> +++ b/util/compatfd.c
> @@ -16,7 +16,9 @@
> #include "qemu/osdep.h"
> #include "qemu/thread.h"
> 
> +#if defined(CONFIG_SIGNALFD)
> #include <sys/syscall.h>
> +#endif
> 
> struct sigfd_compat_info
> {
> diff --git a/util/drm.c b/util/drm.c
> index a23ff24538..8540578c09 100644
> --- a/util/drm.c
> +++ b/util/drm.c
> @@ -38,9 +38,11 @@ int qemu_drm_rendernode_open(const char *rendernode)
> 
>     fd = -1;
>     while ((e = readdir(dir))) {
> +#if !defined(__HAIKU__)
>         if (e->d_type != DT_CHR) {
>             continue;
>         }
> +#endif
> 
>         if (strncmp(e->d_name, "renderD", 7)) {
>             continue;
> diff --git a/util/main-loop.c b/util/main-loop.c
> index eda63fe4e0..1ce3081ced 100644
> --- a/util/main-loop.c
> +++ b/util/main-loop.c
> @@ -85,6 +85,9 @@ static int qemu_signal_init(Error **errp)
>      * by sigwait() in the signal thread. Otherwise, the cpu thread will
>      * not catch it reliably.
>      */
> +#ifndef SIGIO
> +#define SIGIO SIGPOLL
> +#endif
>     sigemptyset(&set);
>     sigaddset(&set, SIG_IPI);
>     sigaddset(&set, SIGIO);
> diff --git a/util/oslib-posix.c b/util/oslib-posix.c
> index 39ddc77c85..a18d90a68a 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].  */
> diff --git a/util/qemu-openpty.c b/util/qemu-openpty.c
> index 2e8b43bdf5..c29fc2cbf9 100644
> --- a/util/qemu-openpty.c
> +++ b/util/qemu-openpty.c
> @@ -35,7 +35,7 @@
> #include "qemu/osdep.h"
> #include "qemu-common.h"
> 
> -#if defined(__GLIBC__)
> +#if defined(__GLIBC__) || defined(__HAIKU__)
> # include <pty.h>
> #elif defined CONFIG_BSD
> # include <termios.h>
> -- 
> 2.26.0
> 




reply via email to

[Prev in Thread] Current Thread [Next in Thread]