[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <58fadc96-2083-a043-9ef3-da72ad792324@isovalent.com>
Date: Wed, 15 Jul 2020 18:35:46 +0100
From: Quentin Monnet <quentin@...valent.com>
To: Tony Ambardar <tony.ambardar@...il.com>,
Alexei Starovoitov <ast@...nel.org>,
Daniel Borkmann <daniel@...earbox.net>
Cc: netdev@...r.kernel.org, bpf@...r.kernel.org
Subject: Re: [PATCH bpf-next] bpftool: use only nftw for file tree parsing
2020-07-14 22:12 UTC-0700 ~ Tony Ambardar <tony.ambardar@...il.com>
> The bpftool sources include code to walk file trees, but use multiple
> frameworks to do so: nftw and fts. While nftw conforms to POSIX/SUSv3 and
> is widely available, fts is not conformant and less common, especially on
> non-glibc systems. The inconsistent framework usage hampers maintenance
> and portability of bpftool, in particular for embedded systems.
>
> Standardize usage by rewriting one fts-based function to use nftw. This
> change allows building bpftool against musl for OpenWrt.
>
> Signed-off-by: Tony Ambardar <Tony.Ambardar@...il.com>
Thanks!
I tested your set, and bpftool does not compile on my setup. The
definitions from <ftw.h> are not picked up by gcc, common.c should have
a "#define _GNU_SOURCE" above its list of includes for this to work
(like perf.c has).
I also get a warning on this line:
> +static int do_build_table_cb(const char *fpath, const struct stat *sb,
> + int typeflag, struct FTW *ftwbuf)
> {
Because passing fptath to open_obj_pinned() below discards the "const"
qualifier:
> + fd = open_obj_pinned(fpath, true);
Fixed by having simply "char *fpath" as the first argument for
do_build_table_cb().
With those two modifications, bpftool compiles fine and listing objects
with the "-f" option works as expected.
Regards,
Quentin
Powered by blists - more mailing lists