@@ -31,7 +31,7 @@ PROG COMMANDS
3131| **bpftool** **prog dump xlated** *PROG* [{**file** *FILE* | **opcodes** | **visual** | **linum**}]
3232| **bpftool** **prog dump jited** *PROG* [{**file** *FILE* | **opcodes** | **linum**}]
3333| **bpftool** **prog pin** *PROG* *FILE*
34- | **bpftool** **prog** { **load** | **loadall** } *OBJ* *PATH* [**type** *TYPE*] [**map** {**idx** *IDX* | **name** *NAME*} *MAP*] [**dev** *NAME*] [**pinmaps** *MAP_DIR*]
34+ | **bpftool** **prog** { **load** | **loadall** } *OBJ* *PATH* [**type** *TYPE*] [**map** {**idx** *IDX* | **name** *NAME*} *MAP*] [**dev** *NAME*] [**pinmaps** *MAP_DIR*] [**autoattach**]
3535| **bpftool** **prog attach** *PROG* *ATTACH_TYPE* [*MAP*]
3636| **bpftool** **prog detach** *PROG* *ATTACH_TYPE* [*MAP*]
3737| **bpftool** **prog tracelog**
@@ -131,7 +131,7 @@ DESCRIPTION
131131 contain a dot character ('.'), which is reserved for future
132132 extensions of *bpffs *.
133133
134- **bpftool prog { load | loadall } ** *OBJ * *PATH * [**type ** *TYPE *] [**map ** {**idx ** *IDX * | **name ** *NAME *} *MAP *] [**dev ** *NAME *] [**pinmaps ** *MAP_DIR *]
134+ **bpftool prog { load | loadall } ** *OBJ * *PATH * [**type ** *TYPE *] [**map ** {**idx ** *IDX * | **name ** *NAME *} *MAP *] [**dev ** *NAME *] [**pinmaps ** *MAP_DIR *] [** autoattach **]
135135 Load bpf program(s) from binary *OBJ * and pin as *PATH *.
136136 **bpftool prog load ** pins only the first program from the
137137 *OBJ * as *PATH *. **bpftool prog loadall ** pins all programs
@@ -150,6 +150,17 @@ DESCRIPTION
150150 Optional **pinmaps ** argument can be provided to pin all
151151 maps under *MAP_DIR * directory.
152152
153+ If **autoattach ** is specified program will be attached
154+ before pin. In that case, only the link (representing the
155+ program attached to its hook) is pinned, not the program as
156+ such, so the path won't show in **bpftool prog show -f **,
157+ only show in **bpftool link show -f **. Also, this only works
158+ when bpftool (libbpf) is able to infer all necessary
159+ information from the object file, in particular, it's not
160+ supported for all program types. If a program does not
161+ support autoattach, bpftool falls back to regular pinning
162+ for that program instead.
163+
153164 Note: *PATH * must be located in *bpffs * mount. It must not
154165 contain a dot character ('.'), which is reserved for future
155166 extensions of *bpffs *.
0 commit comments