Re: [PATCH v1] libbpf: Add namespace for errstr making it libbpf_errstr

From: Ian Rogers
Date: Thu Mar 20 2025 - 18:08:29 EST


On Thu, Mar 20, 2025 at 2:37 PM Andrii Nakryiko
<andrii.nakryiko@xxxxxxxxx> wrote:
>
> On Thu, Mar 20, 2025 at 11:00 AM Ian Rogers <irogers@xxxxxxxxxx> wrote:
> >
> > When statically linking symbols can be replaced with those from other
> > statically linked libraries depending on the link order and the hoped
> > for "multiple definition" error may not appear. To avoid conflicts it
> > is good practice to namespace symbols, this change renames errstr to
> > libbpf_errstr.
> >
> > Fixes: 1633a83bf993 ("libbpf: Introduce errstr() for stringifying errno")
> > Signed-off-by: Ian Rogers <irogers@xxxxxxxxxx>
> > ---
> > I feel like this patch shouldn't be strictly necessary, it turned out
> > for a use-case it was and people who know better than me say the
> > linker is working as intended. The conflicting errstr was from:
> > https://sourceforge.net/projects/linuxquota/
> > The fixes tag may not be strictly necessary.
> > ---
>
> sigh, I do like short errstr(). How about we avoid all this churn by
> naming the function libbpf_errstr() as you did, but then also
> defining:
>
> #define errstr(err) libbpf_errstr(err)
>
> and leaving all existing invocations as is
>
> ?

Works for me. I'll send a v2.

Thanks,
Ian