libbpf_sys/
lib.rs

1// src/lib.rs
2
3#![allow(non_upper_case_globals)]
4#![allow(non_camel_case_types)]
5#![allow(non_snake_case)]
6
7#[allow(clippy::all)]
8mod bindings {
9    #[cfg(all(feature = "bindgen", not(feature = "bindgen-source")))]
10    include!(concat!(env!("OUT_DIR"), "/bindings.rs"));
11    #[cfg(any(not(feature = "bindgen"), feature = "bindgen-source"))]
12    include!("bindings.rs");
13}
14
15pub use bindings::*;
16
17#[cfg(feature = "vendored-libbpf")]
18macro_rules! header {
19    ($file:literal) => {
20        ($file, include_str!(concat!("../libbpf/src/", $file)))
21    };
22}
23
24/// Vendored libbpf headers
25///
26/// Tuple format is: (header filename, header contents)
27#[cfg(feature = "vendored-libbpf")]
28pub const API_HEADERS: [(&str, &str); 10] = [
29    header!("bpf.h"),
30    header!("libbpf.h"),
31    header!("btf.h"),
32    header!("bpf_helpers.h"),
33    header!("bpf_helper_defs.h"),
34    header!("bpf_tracing.h"),
35    header!("bpf_endian.h"),
36    header!("bpf_core_read.h"),
37    header!("libbpf_common.h"),
38    header!("usdt.bpf.h"),
39];