bpf.2: Improvements after comments from Alexei Starovoitov

Reported-by: Alexei Starovoitov <ast@plumgrid.com>
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
This commit is contained in:
Michael Kerrisk 2015-07-22 19:59:35 +02:00
parent 8440f77124
commit 4fba111eca
1 changed files with 7 additions and 6 deletions

View File

@ -852,8 +852,6 @@ ioctl(event_fd, PERF_EVENT_IOC_SET_BPF, prog_fd);
.fi
.in
.\"
.\" FIXME
.\"
.\"
.SH EXAMPLES
.\" FIXME It would be nice if this was a complete working example
@ -895,8 +893,8 @@ main(int argc, char **argv)
/* if (r0 == 0) goto pc+2 */
BPF_MOV64_IMM(BPF_REG_1, 1), /* r1 = 1 */
BPF_XADD(BPF_DW, BPF_REG_0, BPF_REG_1, 0, 0),
.\" FIXME What does 'lock' in the line below mean?
/* lock *(u64 *) r0 += r1 */
.\" == atomic64_add
BPF_MOV64_IMM(BPF_REG_0, 0), /* r0 = 0 */
BPF_EXIT_INSN(), /* return r0 */
};
@ -1054,13 +1052,16 @@ and similar calls.
An eBPF object is deallocated only after all file descriptors
referring to the object have been closed.
eBPF programs can be written in a restricted C that is compiled into
eBPF bytecode and executed on the in-kernel virtual machine or
eBPF programs can be written in a restricted C that is compiled (using the
.B clang
compiler) into eBPF bytecode and executed on the in-kernel virtual machine or
just-in-time compiled into native code.
(Various features are omitted from this restricted C, such as loops,
global variables, variadic functions, floating-point numbers,
and passing structures as function arguments.)
.\" FIXME Add pointers to examples
Some examples can be found in the
.I samples/bpf/*_kern.c
files in the kernel source tree.
.\" samples/bpf/*_kern.c + samples/bpf/Makefile ?
.\" There are also examples for the tc classifier, in the iproute2
.\" project, in examples/bpf