All of lore.kernel.org
 help / color / mirror / Atom feed
From: Alexandru Elisei <alexandru.elisei@arm.com>
To: will@kernel.org, julien.thierry.kdev@gmail.com
Cc: kvm@vger.kernel.org, thomas.perale@mind.be
Subject: Re: [PATCH kvmtool] vfio: include libgen.h (for musl compatibility)
Date: Mon, 30 Jun 2025 10:04:00 +0100	[thread overview]
Message-ID: <aGJTAC-qDsYzPygS@raptor> (raw)
In-Reply-To: <aGJSwh8CqUUF2CgZ@raptor>

Hi,

Adding the maintainers.

On Mon, Jun 30, 2025 at 10:02:58AM +0100, Alexandru Elisei wrote:
> Hi,
> 
> On Sun, Jun 29, 2025 at 10:22:21PM +0200, Thomas Perale wrote:
> > 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>
> 
> Looking at man 3 basename, there are two version of basename, one is the POSIX
> version (this is the one you get by including libgen.h), the other one is the
> GNU version.  I don't think kvmtool cares about the differences (group_path is
> never '/', and it's not a static string), so if the POSIX version makes
> compilation with musl possible:
> 
> Reviewed-by: Alexandru Elisei <alexandru.elisei@arm.com>
> 
> Also checked that this is the only occurence of basename in the sources.
> 
> Thanks,
> Alex
> 
> >  
> >  #define VFIO_DEV_DIR		"/dev/vfio"
> >  #define VFIO_DEV_NODE		VFIO_DEV_DIR "/vfio"
> > -- 
> > 2.50.0
> > 
> > 
> 

  reply	other threads:[~2025-06-30  9:04 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
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 [this message]
2025-07-21 14:35 ` Will Deacon

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=aGJTAC-qDsYzPygS@raptor \
    --to=alexandru.elisei@arm.com \
    --cc=julien.thierry.kdev@gmail.com \
    --cc=kvm@vger.kernel.org \
    --cc=thomas.perale@mind.be \
    --cc=will@kernel.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.