[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[PULL 15/25] util/oslib-posix.c: Implement qemu_init_exec_dir() for Haik
From: |
Peter Maydell |
Subject: |
[PULL 15/25] util/oslib-posix.c: Implement qemu_init_exec_dir() for Haiku |
Date: |
Mon, 13 Jul 2020 15:10:54 +0100 |
From: David CARLIER <devnexen@gmail.com>
The qemu_init_exec_dir() function is inherently non-portable;
provide an implementation for Haiku hosts.
Signed-off-by: David Carlier <devnexen@gmail.com>
Reviewed-by: Peter Maydell <peter.maydell@linaro.org>
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
Message-id: 20200703145614.16684-9-peter.maydell@linaro.org
[PMM: Expanded commit message]
Reviewed-by: Peter Maydell <peter.maydell@linaro.org>
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
---
util/oslib-posix.c | 19 +++++++++++++++++++
1 file changed, 19 insertions(+)
diff --git a/util/oslib-posix.c b/util/oslib-posix.c
index 7ad9195c445..72907d4d7fe 100644
--- a/util/oslib-posix.c
+++ b/util/oslib-posix.c
@@ -60,6 +60,10 @@
#include <mach-o/dyld.h>
#endif
+#ifdef __HAIKU__
+#include <kernel/image.h>
+#endif
+
#include "qemu/mmap-alloc.h"
#ifdef CONFIG_DEBUG_STACK_USAGE
@@ -389,6 +393,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.20.1
- [PULL 06/25] target/arm: Don't do raw writes for PMINTENCLR, (continued)
- [PULL 06/25] target/arm: Don't do raw writes for PMINTENCLR, Peter Maydell, 2020/07/13
- [PULL 05/25] Add the ability to change the FEC PHY MDIO devices numbers on i.MX7 processor, Peter Maydell, 2020/07/13
- [PULL 07/25] virtio-iommu: Fix coverity issue in virtio_iommu_handle_command(), Peter Maydell, 2020/07/13
- [PULL 08/25] build: Enable BSD symbols for Haiku, Peter Maydell, 2020/07/13
- [PULL 09/25] util/qemu-openpty.c: Don't assume pty.h is glibc-only, Peter Maydell, 2020/07/13
- [PULL 10/25] build: Check that mlockall() exists, Peter Maydell, 2020/07/13
- [PULL 11/25] osdep.h: Always include <sys/signal.h> if it exists, Peter Maydell, 2020/07/13
- [PULL 12/25] osdep.h: For Haiku, define SIGIO as equivalent to SIGPOLL, Peter Maydell, 2020/07/13
- [PULL 14/25] util/compatfd.c: Only include <sys/syscall.h> if CONFIG_SIGNALFD, Peter Maydell, 2020/07/13
- [PULL 13/25] bswap.h: Include <endian.h> on Haiku for bswap operations, Peter Maydell, 2020/07/13
- [PULL 15/25] util/oslib-posix.c: Implement qemu_init_exec_dir() for Haiku,
Peter Maydell <=
- [PULL 16/25] util/drm: make portable by avoiding struct dirent d_type, Peter Maydell, 2020/07/13
- [PULL 18/25] target/nios2: in line the semantics of DISAS_UPDATE with other targets, Peter Maydell, 2020/07/13
- [PULL 17/25] target/nios2: add DISAS_NORETURN case for nothing more to generate, Peter Maydell, 2020/07/13
- [PULL 22/25] hw/arm/tosa: Encapsulate misc GPIO handling in a device, Peter Maydell, 2020/07/13
- [PULL 21/25] hw/arm/tosa.c: Detabify, Peter Maydell, 2020/07/13
- [PULL 23/25] hw/arm/palm.c: Detabify, Peter Maydell, 2020/07/13
- [PULL 19/25] target/nios2: Use gen_io_start around wrctl instruction, Peter Maydell, 2020/07/13
- [PULL 20/25] hw/nios2: exit to main CPU loop only when unmasking interrupts, Peter Maydell, 2020/07/13
- [PULL 24/25] hw/arm/palm.c: Encapsulate misc GPIO handling in a device, Peter Maydell, 2020/07/13
- [PULL 25/25] hw/arm/aspeed: Do not create and attach empty SD cards by default, Peter Maydell, 2020/07/13