GSR

The libbpf Documentation Site

October 10, 2021

libbpf is the standard implementation of the userspace library for loading and interacting with bpf programs. It defines the bpf ELF file format and CO-RE features. It’s a crucial part of the bpf ecosystem and is soon approaching its first major release. With this in mind, it’s important to have proper documentation.

Introducing libbpf.readthedocs.org. By going to the API docs you can see that each libbpf API function, type, enum and macro are listed. This is generated from the libbpf header files. Comments can be placed in code above the relevant API code and displayed on the documentation site.

If you’re interested in contributing, you can find a guide on the format for the API documentation comments here. Since libbpf is hosted in the linux kernel repo under tools/lib/bpf, contributing to it requires use of the mailing list. You can check out my guide to using the mailing list as well. The markdown documents on the documentation site can be found under Documentation/bpf/libbpf/.

This documentation is synced to the github mirror. Since libbpf maintainers cut releases from the github mirror, this means that the documentation is also versioned. You can toggle versions on the bottom left corner of the page.

You can also find relevant documentation for the bpf system call here.

copyright 2018 - 2023