libbpf / libbpf-rs

Minimal and opinionated eBPF tooling for the Rust ecosystem
Other
761 stars 133 forks source link

Support returning errors from query API #15

Open danobi opened 4 years ago

danobi commented 4 years ago

The query API is iterator based. Each iteration is technically fallible but there's no great way to report errors.

I played around with making the iterator type by Result<T> but that can cause infinite loops: 24aa7ea561e06dd2a .

Not sure what can be done about it. Maybe https://docs.rs/fallible-iterator/0.2.0/fallible_iterator/ but that library isn't very nice b/c it reimplements much of the iterator standard library helpers.

kckeiks commented 2 years ago

How do your proposed changes cause an infinite loop? Shouldn't we stop when bpf_obj_get_next_id returns a non-zero value?