From: Hisam Mehboob <hisamshar@gmail.com>
To: kvm@vger.kernel.org
Cc: dmatlack@google.com, alex@shazbot.org, shuah@kernel.org,
seanjc@google.com, jrhilke@google.com, rananta@google.com,
vipinsh@google.com, linux-kselftest@vger.kernel.org,
linux-kernel@vger.kernel.org, Hisam Mehboob <hisamshar@gmail.com>
Subject: [PATCH v2] vfio: selftests: Include <libgen.h> for basename() on non-glibc builds
Date: Tue, 25 Aug 2026 03:28:47 +0500 [thread overview]
Message-ID: <20260824222845.459181-3-hisamshar@gmail.com> (raw)
sysfs.c calls basename() but does not include its declaration.
Glibc exposes basename() through <string.h> with _GNU_SOURCE, while
musl declares it in <libgen.h>.
With musl, this results in an implicit-function-declaration error and
subsequent type-mismatch errors at the callers.
Include <libgen.h> so the declaration is available on both glibc and
musl. This is safe at both call sites: the arguments are local writable
char[PATH_MAX] buffers filled by readlink_safe().
Link: https://lore.kernel.org/kvm/CALzav=fs4bqMM7BXNPXqhtbqGzA+LW5fgx2-1Q5=sTN5+krYhw@mail.gmail.com/
Fixes: a262fc49e0aa ("KVM: selftests: Build and link selftests/vfio/lib into KVM selftests")
Reviewed-by: David Matlack <dmatlack@google.com>
Signed-off-by: Hisam Mehboob <hisamshar@gmail.com>
---
v2:
- Changed subject prefix from "selftests/vfio:" to "vfio: selftests:"
- Added David's Reviewed-by tag.
tools/testing/selftests/vfio/lib/sysfs.c | 1 +
1 file changed, 1 insertion(+)
diff --git a/tools/testing/selftests/vfio/lib/sysfs.c b/tools/testing/selftests/vfio/lib/sysfs.c
index 11415448b2e2..daf117a299a6 100644
--- a/tools/testing/selftests/vfio/lib/sysfs.c
+++ b/tools/testing/selftests/vfio/lib/sysfs.c
@@ -1,5 +1,6 @@
// SPDX-License-Identifier: GPL-2.0-only
#include <fcntl.h>
+#include <libgen.h>
#include <unistd.h>
#include <stdlib.h>
#include <string.h>
--
2.51.0
next reply other threads:[~2026-08-24 22:30 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-08-24 22:28 Hisam Mehboob [this message]
2026-09-25 20:49 ` [PATCH v2] vfio: selftests: Include <libgen.h> for basename() on non-glibc builds Alex Williamson
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=20260824222845.459181-3-hisamshar@gmail.com \
--to=hisamshar@gmail.com \
--cc=alex@shazbot.org \
--cc=dmatlack@google.com \
--cc=jrhilke@google.com \
--cc=kvm@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-kselftest@vger.kernel.org \
--cc=rananta@google.com \
--cc=seanjc@google.com \
--cc=shuah@kernel.org \
--cc=vipinsh@google.com \
/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.