#bpf #ebpf #xdp

sys libbpf-sys

Rust bindings to libbpf from the Linux kernel

31 releases

0.8.3+v0.8.1 Jul 19, 2022
0.8.0+v0.8.0 Jun 5, 2022
0.6.1-2 Jan 25, 2022
0.6.0-1 Dec 3, 2021
0.0.0 Nov 7, 2017

#27 in Unix APIs

Download history 4166/week @ 2022-04-22 3717/week @ 2022-04-29 5558/week @ 2022-05-06 5904/week @ 2022-05-13 5967/week @ 2022-05-20 5008/week @ 2022-05-27 5913/week @ 2022-06-03 5567/week @ 2022-06-10 5942/week @ 2022-06-17 6177/week @ 2022-06-24 4607/week @ 2022-07-01 4854/week @ 2022-07-08 5742/week @ 2022-07-15 6231/week @ 2022-07-22 6115/week @ 2022-07-29 6472/week @ 2022-08-05

25,474 downloads per month
Used in 16 crates (11 directly)

BSD-2-Clause

1MB
33K SLoC

C 24K SLoC // 0.1% comments Rust 7.5K SLoC // 0.0% comments Shell 810 SLoC // 0.1% comments BASH 45 SLoC // 0.1% comments Python 22 SLoC // 0.3% comments

libbpf-sys Travis CI build status badge crates.io version number badge

Rust bindings to libbpf from the Linux kernel

Maintainer: Alex Forster <alex@alexforster.com>
License: BSD-2-Clause

libbpf-sys is the packaged result of using bindgen to automatically generate Rust FFI bindings to libbpf from the Linux kernel.

Warning: this crate does not provide a high-level or "safe" API wrapper around libbpf. If you are looking for an easier way to use libbpf, check out these other crates that implement higher-level APIs using libbpf-sys...

The community is encouraged to build higher-level crates using libbpf-sys. Please let me know if you do!

Building

As part of the cargo build process, an included copy of libbpf is compiled and statically linked into the resulting binary. This means that, in order to build a project that depends on this crate, your system must provide a working C compiler toolchain (GCC and Clang should both work). Additionally, your system must provide development headers for zlib and libelf, and they must be discoverable via pkgconfig.

Distribution

When you add this crate as a dependency to your project, your resulting binaries will dynamically link with libz and libelf. This means that the systems where you run your binaries must have these libraries installed.

Versioning

Because the API of this crate is automatically generated from libbpf sources, it uses a versioning scheme based on the version of libbpf that it provides.

The "Major.Minor" semver numbers correspond exactly to the libbpf version that each release provides. For example, the 0.6.x releases of this crate provides the API for the libbpf v0.6.x releases.

In order to allow for human error, the "Patch" semver number is used by this crate and does not necessarily match the provided libbpf version. For example, both the 0.6.1 and 0.6.2 releases of this crate contain bindings to libbpf v0.6.1, but the later release contains bugfixes and/or enhancements to the crate itself.

The exact version of libbpf that is provided by any given release can be found in the "Build Metadata" semver section, which comes after the + in the version string. For example, 0.6.2+v0.6.1 indicates that the crate version is 0.6.2 and the upstream libbpf version is v0.6.1.

Licensing and Dependencies

This crate is released under the BSD 2-Clause license, and is careful to avoid infecting users with viral licenses.

It currently depends on the following third-party libraries:

Website License Linkage
libbpf github.com/libbpf/libbpf LGPL-2.1-only OR BSD-2-Clause Static
libelf sourceware.org/elfutils LGPL-2.1-or-later OR LGPL-3.0-or-later Dynamic
zlib zlib.net Zlib Dynamic

Dependencies