Appendix D. C BPF

This appendix shows examples of BPF tools implemented in C, either as compiled C programs or executed via the perf(1) utility. This appendix is optional material for those readers who are interested in developing a deeper understanding of how BPF works, as well as other BPF interfaces that are supported by the Linux kernel.

Chapter 5 covers how to develop tools in bpftrace, a higher-level language that is expected to be sufficient and preferred in many cases, and Appendix C covers the BCC interface as another preferred option. This appendix is a follow-on from the BPF sections in Chapter 2.

This appendix begins with a discussion on C programming and five tips before you begin. The first program included is hello_world.c, for ...

Get BPF Performance Tools now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.