libbpf_sys/
lib.rs

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
// src/lib.rs

#![allow(non_upper_case_globals)]
#![allow(non_camel_case_types)]
#![allow(non_snake_case)]

#[allow(clippy::all)]
mod bindings {
    #[cfg(all(feature = "bindgen", not(feature = "bindgen-source")))]
    include!(concat!(env!("OUT_DIR"), "/bindings.rs"));
    #[cfg(any(not(feature = "bindgen"), feature = "bindgen-source"))]
    include!("bindings.rs");
}

pub use bindings::*;

#[cfg(feature = "vendored-libbpf")]
macro_rules! header {
    ($file:literal) => {
        ($file, include_str!(concat!("../libbpf/src/", $file)))
    };
}

/// Vendored libbpf headers
///
/// Tuple format is: (header filename, header contents)
#[cfg(feature = "vendored-libbpf")]
pub const API_HEADERS: [(&str, &str); 10] = [
    header!("bpf.h"),
    header!("libbpf.h"),
    header!("btf.h"),
    header!("bpf_helpers.h"),
    header!("bpf_helper_defs.h"),
    header!("bpf_tracing.h"),
    header!("bpf_endian.h"),
    header!("bpf_core_read.h"),
    header!("libbpf_common.h"),
    header!("usdt.bpf.h"),
];