All of lore.kernel.org
 help / color / mirror / Atom feed
From: Brad Smith <brad@comstyle.com>
To: Paolo Bonzini <pbonzini@redhat.com>,
	Marc-Andr_ Lureau <marcandre.lureau@redhat.com>,
	"Daniel P. Berrang_" <berrange@redhat.com>,
	Pierrick Bouvier <pierrick.bouvier@oss.qualcomm.com>
Cc: qemu-devel@nongnu.org
Subject: Re: [PATCH] util/cutils: Use getexecpath() on OpenBSD for qemu_init_exec_dir()
Date: Sun, 18 Oct 2026 22:53:50 -0400	[thread overview]
Message-ID: <041cce96-07da-41ec-ad9b-eba5173d9bb5@comstyle.com> (raw)
In-Reply-To: <aqjqfifkq8gi0w4Z@humpty.home.comstyle.com>

ping.

On 2026-09-15 2:49 a.m., Brad Smith wrote:
> util/cutils: Use getexecpath() on OpenBSD for qemu_init_exec_dir()
>
> OpenBSD has introduced a function getexecpath() to be
> able to retrieve the executable name and path.
>
> Signed-off-by: Brad Smith <brad@comstyle.com>
> ---
>   meson.build   | 8 ++++++++
>   util/cutils.c | 6 ++++++
>   2 files changed, 14 insertions(+)
>
> diff --git a/meson.build b/meson.build
> index cfac634cf1..0e07138b0c 100644
> --- a/meson.build
> +++ b/meson.build
> @@ -3034,6 +3034,14 @@ config_host_data.set('CONFIG_ELF_AUX_INFO', cc.links(osdep_prefix + '''
>       return hwcap;
>     }'''))
>   
> +config_host_data.set('CONFIG_GETEXECPATH', cc.links(osdep_prefix + '''
> +  #include <limits.h>
> +  #include <unistd.h>
> +  int main(void) {
> +    char buf[PATH_MAX];
> +    getexecpath(buf, sizeof(buf));
> +  }'''))
> +
>   config_host_data.set('CONFIG_USBFS', have_linux_user and cc.compiles('''
>     #include <linux/usbdevice_fs.h>
>   
> diff --git a/util/cutils.c b/util/cutils.c
> index 91ddadfd15..b5d1d13e24 100644
> --- a/util/cutils.c
> +++ b/util/cutils.c
> @@ -1091,6 +1091,12 @@ void qemu_init_exec_dir(const char *argv0)
>               p = buf;
>           }
>       }
> +#elif defined(__OpenBSD__) && defined(CONFIG_GETEXECPATH)
> +    {
> +        if (getexecpath(buf, sizeof(buf)) == 0) {
> +            p = buf;
> +        }
> +    }
>   #elif defined(__APPLE__)
>       {
>           char fpath[PATH_MAX];


  reply	other threads:[~2026-10-19  2:54 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-09-15  6:49 [PATCH] util/cutils: Use getexecpath() on OpenBSD for qemu_init_exec_dir() Brad Smith
2026-10-19  2:53 ` Brad Smith [this message]
2026-10-26 12:33 ` Daniel P. Berrangé

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=041cce96-07da-41ec-ad9b-eba5173d9bb5@comstyle.com \
    --to=brad@comstyle.com \
    --cc=berrange@redhat.com \
    --cc=marcandre.lureau@redhat.com \
    --cc=pbonzini@redhat.com \
    --cc=pierrick.bouvier@oss.qualcomm.com \
    --cc=qemu-devel@nongnu.org \
    /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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.