qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] util/oslib-posix : qemu_init_exec_dir implementation for MacOS
@ 2020-05-26 20:40 David CARLIER
  2020-05-26 22:25 ` David CARLIER
                   ` (2 more replies)
  0 siblings, 3 replies; 11+ messages in thread
From: David CARLIER @ 2020-05-26 20:40 UTC (permalink / raw)
  To: qemu-devel, qemu-trivial, pbonzini

From b24a6702beb2a4e2a9c1c03b69c6d1dd07d4cf08 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: current process full path resolution on MacOS

Using existing libproc to fill the path.

Signed-off-by: David Carlier <devnexen@gmail.com>
---
 util/oslib-posix.c | 13 +++++++++++++
 1 file changed, 13 insertions(+)

diff --git a/util/oslib-posix.c b/util/oslib-posix.c
index 062236a1ab..96f0405ee6 100644
--- a/util/oslib-posix.c
+++ b/util/oslib-posix.c
@@ -55,6 +55,10 @@
 #include <sys/sysctl.h>
 #endif

+#ifdef __APPLE__
+#include <libproc.h>
+#endif
+
 #include "qemu/mmap-alloc.h"

 #ifdef CONFIG_DEBUG_STACK_USAGE
@@ -366,6 +370,15 @@ void qemu_init_exec_dir(const char *argv0)
             p = buf;
         }
     }
+#elif defined(__APPLE__)
+    {
+        uint32_t len;
+        len = proc_pidpath(getpid(), buf, sizeof(buf) - 1);
+        if (len > 0) {
+            buf[len] = 0;
+            p = buf;
+        }
+    }
 #endif
     /* If we don't have any way of figuring out the actual executable
        location then try argv[0].  */
-- 
2.26.2


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

end of thread, other threads:[~2020-06-15 16:28 UTC | newest]

Thread overview: 11+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-05-26 20:40 [PATCH] util/oslib-posix : qemu_init_exec_dir implementation for MacOS David CARLIER
2020-05-26 22:25 ` David CARLIER
2020-06-03  6:08 ` Philippe Mathieu-Daudé
2020-06-03  6:16   ` David CARLIER
2020-06-03 14:09   ` Justin Hibbits
2020-06-03 14:22     ` David CARLIER
2020-06-03 14:38       ` Philippe Mathieu-Daudé
2020-06-15 16:26       ` Peter Maydell
2020-06-03 14:36     ` Philippe Mathieu-Daudé
2020-06-03 16:08       ` Justin Hibbits
2020-06-08  6:02 ` Roman Bolshakov

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