* [PATCH kvmtool 0/2] Fix compilation with musl-libc based toolchains
@ 2024-07-27 8:11 J. Neuschäfer
2024-07-27 8:11 ` [PATCH kvmtool 1/2] Get basename() from <libgen.h> for musl compat J. Neuschäfer
2024-07-27 8:11 ` [PATCH kvmtool 2/2] Get __WORDSIZE from <sys/reg.h> " J. Neuschäfer
0 siblings, 2 replies; 5+ messages in thread
From: J. Neuschäfer @ 2024-07-27 8:11 UTC (permalink / raw)
To: kvm; +Cc: J. Neuschäfer
This patchset enables kvmtool to build on musl-libc.
I have also tested that it still builds on glibc.
Signed-off-by: J. Neuschäfer <j.neuschaefer@gmx.net>
---
J. Neuschäfer (2):
Get basename() from <libgen.h> for musl compat
Get __WORDSIZE from <sys/reg.h> for musl compat
include/linux/bitops.h | 2 +-
vfio/core.c | 1 +
2 files changed, 2 insertions(+), 1 deletion(-)
---
base-commit: ca31abf5d9c3453c852b263ccb451751b29b944b
change-id: 20240727-musl-853c66deb931
Best regards,
--
J. Neuschäfer <j.neuschaefer@gmx.net>
^ permalink raw reply [flat|nested] 5+ messages in thread* [PATCH kvmtool 1/2] Get basename() from <libgen.h> for musl compat 2024-07-27 8:11 [PATCH kvmtool 0/2] Fix compilation with musl-libc based toolchains J. Neuschäfer @ 2024-07-27 8:11 ` J. Neuschäfer 2024-07-27 10:58 ` Alyssa Ross 2024-07-27 8:11 ` [PATCH kvmtool 2/2] Get __WORDSIZE from <sys/reg.h> " J. Neuschäfer 1 sibling, 1 reply; 5+ messages in thread From: J. Neuschäfer @ 2024-07-27 8:11 UTC (permalink / raw) To: kvm; +Cc: J. Neuschäfer According to the manpage, basename is defined in <libgen.h>. Not including it results in a compilation failure on musl-libc: vfio/core.c:538:22: error: implicit declaration of function 'basename' [-Werror=implicit-function-declaration] 538 | group_name = basename(group_path); | ^~~~~~~~ Signed-off-by: J. Neuschäfer <j.neuschaefer@gmx.net> --- 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.43.0 ^ permalink raw reply related [flat|nested] 5+ messages in thread
* Re: [PATCH kvmtool 1/2] Get basename() from <libgen.h> for musl compat 2024-07-27 8:11 ` [PATCH kvmtool 1/2] Get basename() from <libgen.h> for musl compat J. Neuschäfer @ 2024-07-27 10:58 ` Alyssa Ross 2024-07-27 16:43 ` J. Neuschäfer 0 siblings, 1 reply; 5+ messages in thread From: Alyssa Ross @ 2024-07-27 10:58 UTC (permalink / raw) To: J. Neuschäfer; +Cc: kvm [-- Attachment #1: Type: text/plain, Size: 1035 bytes --] On Sat, Jul 27, 2024 at 10:11:14AM GMT, J. Neuschäfer wrote: > According to the manpage, basename is defined in <libgen.h>. > Not including it results in a compilation failure on musl-libc: That's not quite what the man page says — there are two versions of basename, the POSIX version and the GNU version, with differing behaviour. > vfio/core.c:538:22: error: implicit declaration of function 'basename' [-Werror=implicit-function-declaration] > 538 | group_name = basename(group_path); > | ^~~~~~~~ In this case, it should be safe to switch to the POSIX version, because group_path is writeable and not used after this, so Reviewed-by: Alyssa Ross <hi@alyssa.is> but it would be nicer if the commit message was clearer, because it currently reads like it's just including a missing header, rather than changing the behaviour of the function. > Signed-off-by: J. Neuschäfer <j.neuschaefer@gmx.net> > --- > vfio/core.c | 1 + > 1 file changed, 1 insertion(+) [-- Attachment #2: signature.asc --] [-- Type: application/pgp-signature, Size: 833 bytes --] ^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [PATCH kvmtool 1/2] Get basename() from <libgen.h> for musl compat 2024-07-27 10:58 ` Alyssa Ross @ 2024-07-27 16:43 ` J. Neuschäfer 0 siblings, 0 replies; 5+ messages in thread From: J. Neuschäfer @ 2024-07-27 16:43 UTC (permalink / raw) To: Alyssa Ross; +Cc: J. Neuschäfer, kvm [-- Attachment #1: Type: text/plain, Size: 1084 bytes --] On Sat, Jul 27, 2024 at 12:58:37PM +0200, Alyssa Ross wrote: > On Sat, Jul 27, 2024 at 10:11:14AM GMT, J. Neuschäfer wrote: > > According to the manpage, basename is defined in <libgen.h>. > > Not including it results in a compilation failure on musl-libc: > > That's not quite what the man page says — there are two versions of > basename, the POSIX version and the GNU version, with differing > behaviour. Right, thanks for catching that! > > vfio/core.c:538:22: error: implicit declaration of function 'basename' [-Werror=implicit-function-declaration] > > 538 | group_name = basename(group_path); > > | ^~~~~~~~ > > In this case, it should be safe to switch to the POSIX version, because > group_path is writeable and not used after this, so > > Reviewed-by: Alyssa Ross <hi@alyssa.is> > > but it would be nicer if the commit message was clearer, because it > currently reads like it's just including a missing header, rather than > changing the behaviour of the function. I'll update and respin. -- jn [-- Attachment #2: signature.asc --] [-- Type: application/pgp-signature, Size: 833 bytes --] ^ permalink raw reply [flat|nested] 5+ messages in thread
* [PATCH kvmtool 2/2] Get __WORDSIZE from <sys/reg.h> for musl compat 2024-07-27 8:11 [PATCH kvmtool 0/2] Fix compilation with musl-libc based toolchains J. Neuschäfer 2024-07-27 8:11 ` [PATCH kvmtool 1/2] Get basename() from <libgen.h> for musl compat J. Neuschäfer @ 2024-07-27 8:11 ` J. Neuschäfer 1 sibling, 0 replies; 5+ messages in thread From: J. Neuschäfer @ 2024-07-27 8:11 UTC (permalink / raw) To: kvm; +Cc: J. Neuschäfer musl-libc doesn't provide <bits/wordsize.h>, but it defines __WORDSIZE in <sys/reg.h> and <sys/user.h>. Signed-off-by: J. Neuschäfer <j.neuschaefer@gmx.net> --- include/linux/bitops.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/include/linux/bitops.h b/include/linux/bitops.h index ae33922..4f133ba 100644 --- a/include/linux/bitops.h +++ b/include/linux/bitops.h @@ -1,7 +1,7 @@ #ifndef _KVM_LINUX_BITOPS_H_ #define _KVM_LINUX_BITOPS_H_ -#include <bits/wordsize.h> +#include <sys/reg.h> #include <linux/kernel.h> #include <linux/compiler.h> -- 2.43.0 ^ permalink raw reply related [flat|nested] 5+ messages in thread
end of thread, other threads:[~2024-07-27 16:43 UTC | newest] Thread overview: 5+ messages (download: mbox.gz follow: Atom feed -- links below jump to the message on this page -- 2024-07-27 8:11 [PATCH kvmtool 0/2] Fix compilation with musl-libc based toolchains J. Neuschäfer 2024-07-27 8:11 ` [PATCH kvmtool 1/2] Get basename() from <libgen.h> for musl compat J. Neuschäfer 2024-07-27 10:58 ` Alyssa Ross 2024-07-27 16:43 ` J. Neuschäfer 2024-07-27 8:11 ` [PATCH kvmtool 2/2] Get __WORDSIZE from <sys/reg.h> " J. Neuschäfer
This is a public inbox, see mirroring instructions for how to clone and mirror all data and code used for this inbox