Re: [PATCH bpf-next] bpftool: use only nftw for file tree parsing

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



2020-07-14 22:12 UTC-0700 ~ Tony Ambardar <tony.ambardar@xxxxxxxxx>
> 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@xxxxxxxxx>

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



[Index of Archives]     [Linux Samsung SoC]     [Linux Rockchip SoC]     [Linux Actions SoC]     [Linux for Synopsys ARC Processors]     [Linux NFS]     [Linux NILFS]     [Linux USB Devel]     [Video for Linux]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]


  Powered by Linux