xtask: fix include paths for kernel headers bundled with libbpf

pull/25/head
Alessandro Decina 3 years ago
parent 08c71dfeb1
commit 8cd669ca9a

@ -1,4 +1,8 @@
#include <linux/types.h>
// __wsum is missing from types.h, see
// https://elixir.bootlin.com/linux/v5.13/source/include/uapi/linux/types.h
typedef __u32 __bitwise __wsum;
#include <linux/bpf.h>
#include <linux/ptrace.h>
#include <sys/socket.h>

@ -1,7 +1,5 @@
use core::{marker::PhantomData, mem};
use aya_bpf_cty::c_void;
use crate::{
bindings::{bpf_map_def, bpf_map_type::BPF_MAP_TYPE_QUEUE},
helpers::{bpf_map_pop_elem, bpf_map_push_elem},

@ -22,6 +22,14 @@ fn codegen_internal_btf_bindings(opts: &Options) -> Result<(), anyhow::Error> {
.unwrap()
.to_string_lossy()
))
.clang_arg(format!(
"-I{}",
opts.libbpf_dir
.join("include")
.canonicalize()
.unwrap()
.to_string_lossy()
))
.header(
opts.libbpf_dir
.join("src/libbpf_internal.h")

@ -21,6 +21,11 @@ pub fn codegen(opts: &Options) -> Result<(), anyhow::Error> {
let builder = || {
let mut bindgen = bindgen::bpf_builder()
.header(&*dir.join("include/bindings.h").to_string_lossy())
.clang_args(&[
"-I",
&*opts.libbpf_dir.join("include/uapi").to_string_lossy(),
])
.clang_args(&["-I", &*opts.libbpf_dir.join("include").to_string_lossy()])
.clang_args(&["-I", &*opts.libbpf_dir.join("src").to_string_lossy()])
// open aya-bpf-bindings/.../bindings.rs and look for mod
// _bindgen, those are anonymous enums

Loading…
Cancel
Save