[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[PULL 02/42] util/oslib-posix : qemu_init_exec_dir implementation for Ma
From: |
Peter Maydell |
Subject: |
[PULL 02/42] util/oslib-posix : qemu_init_exec_dir implementation for Mac |
Date: |
Tue, 23 Jun 2020 12:38:24 +0100 |
From: David CARLIER <devnexen@gmail.com>
>From 3025a0ce3fdf7d3559fc35a52c659f635f5c750c Mon Sep 17 00:00:00 2001
From: David Carlier <devnexen@gmail.com>
Date: Tue, 26 May 2020 21:35:27 +0100
Subject: [PATCH] util/oslib-posix : qemu_init_exec_dir implementation for Mac
Using dyld API to get the full path of the current process.
Signed-off-by: David Carlier <devnexen@gmail.com>
Message-id: CA+XhMqxwC10XHVs4Z-JfE0-WLAU3ztDuU9QKVi31mjr59HWCxg@mail.gmail.com
Reviewed-by: Peter Maydell <peter.maydell@linaro.org>
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
---
util/oslib-posix.c | 15 +++++++++++++++
1 file changed, 15 insertions(+)
diff --git a/util/oslib-posix.c b/util/oslib-posix.c
index 916f1be2243..39ddc77c85b 100644
--- a/util/oslib-posix.c
+++ b/util/oslib-posix.c
@@ -57,6 +57,10 @@
#include <lwp.h>
#endif
+#ifdef __APPLE__
+#include <mach-o/dyld.h>
+#endif
+
#include "qemu/mmap-alloc.h"
#ifdef CONFIG_DEBUG_STACK_USAGE
@@ -375,6 +379,17 @@ void qemu_init_exec_dir(const char *argv0)
p = buf;
}
}
+#elif defined(__APPLE__)
+ {
+ char fpath[PATH_MAX];
+ uint32_t len = sizeof(fpath);
+ if (_NSGetExecutablePath(fpath, &len) == 0) {
+ p = realpath(fpath, buf);
+ if (!p) {
+ return;
+ }
+ }
+ }
#endif
/* If we don't have any way of figuring out the actual executable
location then try argv[0]. */
--
2.20.1
- [PULL 00/42] target-arm queue, Peter Maydell, 2020/06/23
- [PULL 01/42] hw/arm/virt: Add 5.0 HW compat props, Peter Maydell, 2020/06/23
- [PULL 02/42] util/oslib-posix : qemu_init_exec_dir implementation for Mac,
Peter Maydell <=
- [PULL 03/42] target/arm: Convert Neon 2-reg-misc VREV64 to decodetree, Peter Maydell, 2020/06/23
- [PULL 05/42] target/arm: Convert VZIP, VUZP to decodetree, Peter Maydell, 2020/06/23
- [PULL 04/42] target/arm: Convert Neon 2-reg-misc pairwise ops to decodetree, Peter Maydell, 2020/06/23
- [PULL 07/42] target/arm: Convert Neon 2-reg-misc VSHLL to decodetree, Peter Maydell, 2020/06/23
- [PULL 06/42] target/arm: Convert Neon narrowing moves to decodetree, Peter Maydell, 2020/06/23
- [PULL 08/42] target/arm: Convert Neon VCVT f16/f32 insns to decodetree, Peter Maydell, 2020/06/23
- [PULL 09/42] target/arm: Convert vectorised 2-reg-misc Neon ops to decodetree, Peter Maydell, 2020/06/23
- [PULL 11/42] target/arm: Rename NeonGenOneOpFn to NeonGenOne64OpFn, Peter Maydell, 2020/06/23
- [PULL 10/42] target/arm: Convert Neon 2-reg-misc crypto operations to decodetree, Peter Maydell, 2020/06/23
- [PULL 13/42] target/arm: Make gen_swap_half() take separate src and dest, Peter Maydell, 2020/06/23