* [PATCH] util/cutils: Use getexecpath() on OpenBSD for qemu_init_exec_dir()
@ 2026-09-15 6:49 Brad Smith
2026-10-19 2:53 ` Brad Smith
2026-10-26 12:33 ` Daniel P. Berrangé
0 siblings, 2 replies; 3+ messages in thread
From: Brad Smith @ 2026-09-15 6:49 UTC (permalink / raw)
To: Paolo Bonzini, Marc-Andr_ Lureau, Daniel P. Berrang_,
Pierrick Bouvier
Cc: qemu-devel
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];
--
2.55.0
^ permalink raw reply related [flat|nested] 3+ messages in thread
* Re: [PATCH] util/cutils: Use getexecpath() on OpenBSD for qemu_init_exec_dir()
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
2026-10-26 12:33 ` Daniel P. Berrangé
1 sibling, 0 replies; 3+ messages in thread
From: Brad Smith @ 2026-10-19 2:53 UTC (permalink / raw)
To: Paolo Bonzini, Marc-Andr_ Lureau, Daniel P. Berrang_,
Pierrick Bouvier
Cc: qemu-devel
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];
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [PATCH] util/cutils: Use getexecpath() on OpenBSD for qemu_init_exec_dir()
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
@ 2026-10-26 12:33 ` Daniel P. Berrangé
1 sibling, 0 replies; 3+ messages in thread
From: Daniel P. Berrangé @ 2026-10-26 12:33 UTC (permalink / raw)
To: Brad Smith; +Cc: Paolo Bonzini, Marc-Andr_ Lureau, Pierrick Bouvier, qemu-devel
On Tue, Sep 15, 2026 at 02:49:34AM -0400, 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(+)
Reviewed-by: Daniel P. Berrangé <berrange@redhat.com>
I'll include this if no one else picks it up before my next misc
pull request
With regards,
Daniel
--
|: https://berrange.com ~~ https://hachyderm.io/@berrange :|
|: https://libvirt.org ~~ https://entangle-photo.org :|
|: https://pixelfed.art/berrange ~~ https://fstop138.berrange.com :|
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2026-10-26 12:33 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
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
2026-10-26 12:33 ` Daniel P. Berrangé
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.