[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [PATCH v3] util/oslib-posix: : qemu_init_exec_dir implementation for
From: |
Peter Maydell |
Subject: |
Re: [PATCH v3] util/oslib-posix: : qemu_init_exec_dir implementation for Mac |
Date: |
Mon, 15 Jun 2020 20:05:46 +0100 |
On Mon, 15 Jun 2020 at 18:06, David CARLIER <devnexen@gmail.com> wrote:
>
> From dfa1e900dd950f4d3fca17fbf5d3dfb5725c83fa 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>
> +#elif defined(__APPLE__)
> + {
> + uint32_t len = (uint32_t)sizeof(buf);
Why do we need the cast?
> + if (_NSGetExecutablePath(buf, &len) == 0) {
> + buf[len - 1] = 0;
> + p = buf;
> + }
> + }
What does this return if you start QEMU with a relative
path (eg "./qemu-system-x86_64") ? The documentation
suggests that you need to call realpath() to resolve that kind
of relative path.
Did you try the test I suggested with checking that this
actually does return something different from argv[0] ?
thanks
-- PMM