Add recursive dumping for maps of maps, including shared inner maps,
BTF formatting, unchanged default output and bounded descriptor usage.

Changes in v3:
- Close inherited descriptors in the low-FD-limit child before setting
  RLIMIT_NOFILE=32. Use /proc/self/fd rather than requiring close_range
  syscall definitions or support from the running kernel.
- Open 32 extra descriptors before fork to cover the reported failure;
  verify that the parent's descriptors and outer map remain usable.
- Rename the global option to recursive_dump, reflow the option text,
  separate the JSON paragraph and fix multiline comment openings.
- Document JSON container closure without promising that every kind of
  traversal diagnostic is included in stdout.
- Use the required tool:model Assisted-by attribution format.

Validation:
- Full bpftool and focused BPF selftest builds with LLVM 20, plus man page
  generation, succeeded.
- All 69 focused subtests passed with the flags, ring-buffer and batch
  v2 series in an x86-64 KVM guest running Linux 7.3.0-rc1.
- After the final descriptor-cleanup adjustment, all 12 recursive dump
  subtests passed again, including both low-FD-limit cases.
- No skips or failures in these focused runs; the full BPF selftest
  suite was not run.

v2: https://lore.kernel.org/r/[email protected]
Request: https://github.com/libbpf/bpftool/issues/58

Tianyi Chen (2):
  bpftool: Add recursive map dumping
  selftests/bpf: Cover recursive bpftool map dumps

 .../bpf/bpftool/Documentation/bpftool-map.rst |  22 +-
 tools/bpf/bpftool/bash-completion/bpftool     |   2 +-
 tools/bpf/bpftool/main.c                      |   7 +-
 tools/bpf/bpftool/main.h                      |   1 +
 tools/bpf/bpftool/map.c                       | 130 ++++-
 .../bpf/prog_tests/bpftool_map_dump.c         | 465 ++++++++++++++++++
 6 files changed, 616 insertions(+), 11 deletions(-)
 create mode 100644 tools/testing/selftests/bpf/prog_tests/bpftool_map_dump.c

-- 
2.55.0


Reply via email to