qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: Paolo Bonzini <pbonzini@redhat.com>
To: qemu-devel@nongnu.org, Peter Maydell <peter.maydell@linaro.net>
Cc: Kevin Wolf <kwolf@redhat.com>,
	Stefan Hajnoczi <stefanha@redhat.com>,
	Michael Tokarev <mjt@tls.msk.ru>, Alex Bligh <alex@alex.org.uk>,
	Miroslav Rezanina <mrezanin@redhat.com>,
	Lluis Vilanova <vilanova@ac.upc.edu>,
	Richard Henderson <rth@twiddle.net>
Subject: Re: [Qemu-devel] [PATCH v18 00/10] Shared library module support
Date: Fri,  7 Feb 2014 00:38:12 +0100	[thread overview]
Message-ID: <1391729892-17783-1-git-send-email-pbonzini@redhat.com> (raw)
In-Reply-To: CAFEAcA_gDgVp7FS97XgSOAzT7MbFkhBVM4OesM0mZo=1MZnQ1Q@mail.gmail.com

> Looks like we're not getting the executable path
> correctly on MacOS for some reason.

Indeed, there is no code for it.  Can you try the patch below?

> Also, mjt pointed out on IRC that we probably want to allow
> installing binary modules into a path with the arch name in
> it, to allow for multiarch distros.

Isn't --libdir enough?

Paolo

==================== 8< ========================
From: Paolo Bonzini <pbonzini@redhat.com>
Date: Wed, 5 Feb 2014 21:15:01 +0100
Subject: [PATCH] oslib: port qemu_exec_dir to Darwin

Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
---
 util/oslib-posix.c | 15 +++++++++++++++
 1 file changed, 15 insertions(+)

diff --git a/util/oslib-posix.c b/util/oslib-posix.c
index 372b2f9..590a7d1 100644
--- a/util/oslib-posix.c
+++ b/util/oslib-posix.c
@@ -59,6 +59,12 @@ extern int daemon(int, int);
 #include <sys/mman.h>
 #include <libgen.h>
 
+/* Get declaration of _NSGetExecutablePath on MacOS X 10.2 or newer.  */
+#if defined(__APPLE__) && defined(__MACH__)
+#define ENUM_DYLD_BOOL
+#include <mach-o/dyld.h>
+#endif
+
 #ifdef CONFIG_LINUX
 #include <sys/syscall.h>
 #endif
@@ -303,6 +309,15 @@ char *qemu_exec_dir(const char *argv0)
             p = buf;
         }
     }
+#elif defined(__APPLE__) && defined(__MACH__)
+    {
+        char result[PATH_MAX];
+        uint32_t length = PATH_MAX;
+        if (_NSGetExecutablePath (result, &length) != 0 || result[0] != '/') {
+            return NULL;
+        }
+        p = realpath(result, buf);
+    }
 #endif
     /* If we don't have any way of figuring out the actual executable
        location then try argv[0].  */
-- 
1.8.5.3

  reply	other threads:[~2014-02-06 23:38 UTC|newest]

Thread overview: 18+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-01-31 14:49 [Qemu-devel] [PATCH v18 00/10] Shared library module support Paolo Bonzini
2014-01-31 14:49 ` [Qemu-devel] [PATCH v18 01/10] util: Split out qemu_exec_dir from os_find_datadir Paolo Bonzini
2014-01-31 14:49 ` [Qemu-devel] [PATCH v18 02/10] rules.mak: fix $(obj) to a real relative path Paolo Bonzini
2014-01-31 14:49 ` [Qemu-devel] [PATCH v18 03/10] rules.mak: allow per object cflags and libs Paolo Bonzini
2014-01-31 14:49 ` [Qemu-devel] [PATCH v18 04/10] block: use per-object " Paolo Bonzini
2014-01-31 14:49 ` [Qemu-devel] [PATCH v18 05/10] darwin: do not use -mdynamic-no-pic Paolo Bonzini
2014-01-31 14:49 ` [Qemu-devel] [PATCH v18 06/10] rules.mak: introduce DSO rules Paolo Bonzini
2014-01-31 14:49 ` [Qemu-devel] [PATCH v18 07/10] module: implement module loading Paolo Bonzini
2014-01-31 14:49 ` [Qemu-devel] [PATCH v18 08/10] Makefile: install modules with "make install" Paolo Bonzini
2014-01-31 14:49 ` [Qemu-devel] [PATCH v18 09/10] Makefile: introduce common-obj-m and block-obj-m for DSO Paolo Bonzini
2014-01-31 14:49 ` [Qemu-devel] [PATCH v18 10/10] block: convert block drivers linked with libs to modules Paolo Bonzini
2014-02-05 18:19 ` [Qemu-devel] [PATCH v18 00/10] Shared library module support Peter Maydell
2014-02-06 23:38   ` Paolo Bonzini [this message]
2014-02-07  0:06     ` Peter Maydell
2014-02-07  7:13       ` Paolo Bonzini
2014-02-07  8:14         ` Michael Tokarev
2014-02-07  8:38           ` Paolo Bonzini
2014-02-07  8:40           ` Fam Zheng

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1391729892-17783-1-git-send-email-pbonzini@redhat.com \
    --to=pbonzini@redhat.com \
    --cc=alex@alex.org.uk \
    --cc=kwolf@redhat.com \
    --cc=mjt@tls.msk.ru \
    --cc=mrezanin@redhat.com \
    --cc=peter.maydell@linaro.net \
    --cc=qemu-devel@nongnu.org \
    --cc=rth@twiddle.net \
    --cc=stefanha@redhat.com \
    --cc=vilanova@ac.upc.edu \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).