.\" Man page generated from reStructuredText. . .TH BPFTOOL-ITER 8 "" "" "" .SH NAME bpftool-iter \- tool to create BPF iterators . .nr rst2man-indent-level 0 . .de1 rstReportMargin \\$1 \\n[an-margin] level \\n[rst2man-indent-level] level margin: \\n[rst2man-indent\\n[rst2man-indent-level]] - \\n[rst2man-indent0] \\n[rst2man-indent1] \\n[rst2man-indent2] .. .de1 INDENT .\" .rstReportMargin pre: . RS \\$1 . nr rst2man-indent\\n[rst2man-indent-level] \\n[an-margin] . nr rst2man-indent-level +1 .\" .rstReportMargin post: .. .de UNINDENT . RE .\" indent \\n[an-margin] .\" old: \\n[rst2man-indent\\n[rst2man-indent-level]] .nr rst2man-indent-level -1 .\" new: \\n[rst2man-indent\\n[rst2man-indent-level]] .in \\n[rst2man-indent\\n[rst2man-indent-level]]u .. .SH SYNOPSIS .INDENT 0.0 .INDENT 3.5 \fBbpftool\fP [\fIOPTIONS\fP] \fBiter\fP \fICOMMAND\fP .sp \fIOPTIONS\fP := { { \fB\-j\fP | \fB\-\-json\fP } [{ \fB\-p\fP | \fB\-\-pretty\fP }] | { \fB\-d\fP | \fB\-\-debug\fP } | { \fB\-l\fP | \fB\-\-legacy\fP } } .sp \fICOMMANDS\fP := { \fBpin\fP | \fBhelp\fP } .UNINDENT .UNINDENT .SH ITER COMMANDS .nf \fBbpftool\fP \fBiter pin\fP \fIOBJ\fP \fIPATH\fP [\fBmap\fP \fIMAP\fP] \fBbpftool\fP \fBiter help\fP \fIOBJ\fP := /a/file/of/bpf_iter_target.o \fIMAP\fP := { \fBid\fP \fIMAP_ID\fP | \fBpinned\fP \fIFILE\fP } .fi .sp .SH DESCRIPTION .INDENT 0.0 .INDENT 3.5 .INDENT 0.0 .TP .B \fBbpftool iter pin\fP \fIOBJ\fP \fIPATH\fP [\fBmap\fP \fIMAP\fP] A bpf iterator combines a kernel iterating of particular kernel data (e.g., tasks, bpf_maps, etc.) and a bpf program called for each kernel data object (e.g., one task, one bpf_map, etc.). User space can \fIread\fP kernel iterator output through \fIread()\fP syscall. .sp The \fIpin\fP command creates a bpf iterator from \fIOBJ\fP, and pin it to \fIPATH\fP\&. The \fIPATH\fP should be located in \fIbpffs\fP mount. It must not contain a dot character (\(aq.\(aq), which is reserved for future extensions of \fIbpffs\fP\&. .sp Map element bpf iterator requires an additional parameter \fIMAP\fP so bpf program can iterate over map elements for that map. User can have a bpf program in kernel to run with each map element, do checking, filtering, aggregation, etc. without copying data to user space. .sp User can then \fIcat PATH\fP to see the bpf iterator output. .TP .B \fBbpftool iter help\fP Print short help message. .UNINDENT .UNINDENT .UNINDENT .SH OPTIONS .INDENT 0.0 .INDENT 3.5 .INDENT 0.0 .TP .B \-h\fP,\fB \-\-help Print short help message (similar to \fBbpftool help\fP). .TP .B \-V\fP,\fB \-\-version Print bpftool\(aqs version number (similar to \fBbpftool version\fP), the number of the libbpf version in use, and optional features that were included when bpftool was compiled. Optional features include linking against libbfd to provide the disassembler for JIT\-ted programs (\fBbpftool prog dump jited\fP) and usage of BPF skeletons (some features like \fBbpftool prog profile\fP or showing pids associated to BPF objects may rely on it). .TP .B \-j\fP,\fB \-\-json Generate JSON output. For commands that cannot produce JSON, this option has no effect. .TP .B \-p\fP,\fB \-\-pretty Generate human\-readable JSON output. Implies \fB\-j\fP\&. .TP .B \-d\fP,\fB \-\-debug Print all logs available, even debug\-level information. This includes logs from libbpf as well as from the verifier, when attempting to load programs. .TP .B \-l\fP,\fB \-\-legacy Use legacy libbpf mode which has more relaxed BPF program requirements. By default, bpftool has more strict requirements about section names, changes pinning logic and doesn\(aqt support some of the older non\-BTF map declarations. .sp See \fI\%https://github.com/libbpf/libbpf/wiki/Libbpf:\-the\-road\-to\-v1.0\fP for details. .UNINDENT .UNINDENT .UNINDENT .SH EXAMPLES .sp \fB# bpftool iter pin bpf_iter_netlink.o /sys/fs/bpf/my_netlink\fP .INDENT 0.0 .INDENT 3.5 .sp .nf .ft C Create a file\-based bpf iterator from bpf_iter_netlink.o and pin it to /sys/fs/bpf/my_netlink .ft P .fi .UNINDENT .UNINDENT .sp \fB# bpftool iter pin bpf_iter_hashmap.o /sys/fs/bpf/my_hashmap map id 20\fP .INDENT 0.0 .INDENT 3.5 .sp .nf .ft C Create a file\-based bpf iterator from bpf_iter_hashmap.o and map with id 20, and pin it to /sys/fs/bpf/my_hashmap .ft P .fi .UNINDENT .UNINDENT .SH SEE ALSO .INDENT 0.0 .INDENT 3.5 \fBbpf\fP(2), \fBbpf\-helpers\fP(7), \fBbpftool\fP(8), \fBbpftool\-btf\fP(8), \fBbpftool\-cgroup\fP(8), \fBbpftool\-feature\fP(8), \fBbpftool\-gen\fP(8), \fBbpftool\-link\fP(8), \fBbpftool\-map\fP(8), \fBbpftool\-net\fP(8), \fBbpftool\-perf\fP(8), \fBbpftool\-prog\fP(8), \fBbpftool\-struct_ops\fP(8) .UNINDENT .UNINDENT .\" Generated by docutils manpage writer. .