aya-rs / aya

Aya is an eBPF library for the Rust programming language, built with a focus on developer experience and operability.
https://aya-rs.dev/book/
Apache License 2.0
3.11k stars 276 forks source link

Document minimum kernel version required for bpf helpers #113

Open hsqStephenZhang opened 2 years ago

hsqStephenZhang commented 2 years ago

i noticed that linux 5.15 add time related bpf helper functions, it just changes so fast, maybe checking the kernel version? Or just adding some '#[cfg(some_version)]' so that developer will not misuse helper functions?

alessandrod commented 2 years ago

eBPF programs can be written to be portable across many kernel versions, so we can't do this at compile time. I think we should somehow generate a "minimum kernel version" section in the documentation for helpers, like we do for other APIs, eg: https://docs.rs/aya/0.10.6/aya/programs/struct.BtfTracePoint.html#minimum-kernel-version

hsqStephenZhang commented 2 years ago

yeah, that's a better approach