[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[PATCH v3 8/9] util/oslib-posix.c: Implement qemu_init_exec_dir() for Ha
From: |
Peter Maydell |
Subject: |
[PATCH v3 8/9] util/oslib-posix.c: Implement qemu_init_exec_dir() for Haiku |
Date: |
Fri, 3 Jul 2020 15:56:13 +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>
[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
- Re: [PATCH v3 4/9] osdep.h: Always include <sys/signal.h> if it exists, (continued)
- [PATCH v3 6/9] bswap.h: Include <endian.h> on Haiku for bswap operations, Peter Maydell, 2020/07/03
- [PATCH v3 5/9] osdep.h: For Haiku, define SIGIO as equivalent to SIGPOLL, Peter Maydell, 2020/07/03
- [PATCH v3 7/9] util/compatfd.c: Only include <sys/syscall.h> if CONFIG_SIGNALFD, Peter Maydell, 2020/07/03
- [PATCH v3 8/9] util/oslib-posix.c: Implement qemu_init_exec_dir() for Haiku,
Peter Maydell <=
- [PATCH v3 9/9] util/drm: make portable by avoiding struct dirent d_type, Peter Maydell, 2020/07/03
- Re: [PATCH v3 0/9] Build fixes for Haiku, Peter Maydell, 2020/07/11