Kernel KVM virtualization development
 help / color / mirror / Atom feed
* [PATCH kvmtool] vfio: include libgen.h (for musl compatibility)
@ 2025-06-29 20:22 Thomas Perale
  2025-06-30  9:02 ` Alexandru Elisei
  2025-07-21 14:35 ` Will Deacon
  0 siblings, 2 replies; 4+ messages in thread
From: Thomas Perale @ 2025-06-29 20:22 UTC (permalink / raw)
  To: kvm; +Cc: thomas.perale

Starting GCC14 'implicit-function-declaration' are treated as errors by
default. When building kvmtool with musl libc, the following error
occurs due to missing declaration of 'basename':

vfio/core.c:537:22: error: implicit declaration of function ‘basename’ [-Wimplicit-function-declaration]
  537 |         group_name = basename(group_path);
      |                      ^~~~~~~~
vfio/core.c:537:22: warning: nested extern declaration of ‘basename’ [-Wnested-externs]
vfio/core.c:537:20: error: assignment to ‘char *’ from ‘int’ makes pointer from integer without a cast [-Wint-conversion]
  537 |         group_name = basename(group_path);
      |                    ^

This patch fixes the issue by including the appropriate header, ensuring
compatibility with musl and GCC14.

Signed-off-by: Thomas Perale <thomas.perale@mind.be>
Signed-off-by: Thomas Perale <perale.thomas@gmail.com>
---
 vfio/core.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/vfio/core.c b/vfio/core.c
index 3ff2c0b..8f88489 100644
--- a/vfio/core.c
+++ b/vfio/core.c
@@ -3,6 +3,7 @@
 #include "kvm/ioport.h"
 
 #include <linux/list.h>
+#include <libgen.h>
 
 #define VFIO_DEV_DIR		"/dev/vfio"
 #define VFIO_DEV_NODE		VFIO_DEV_DIR "/vfio"
-- 
2.50.0


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

end of thread, other threads:[~2025-07-21 14:36 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2025-06-29 20:22 [PATCH kvmtool] vfio: include libgen.h (for musl compatibility) Thomas Perale
2025-06-30  9:02 ` Alexandru Elisei
2025-06-30  9:04   ` Alexandru Elisei
2025-07-21 14:35 ` Will Deacon

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox