Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

aya: feature helpers for kernel capabilities #970

Closed

Conversation

martinsoees
Copy link

Enables feature detection from user space by trying to create maps and reporting back if it succeeded or not.

This is a better way of determining if the kernel supports e.g. ring buffers by creating a ringbuf map type and checking the result, than by relying on the kernel version.

This could be expanded to many more features such as libbpf does in https://github.com/libbpf/libbpf/blob/master/src/features.c

Copy link

netlify bot commented Jun 19, 2024

Deploy Preview for aya-rs-docs failed.

Built without sensitive environment variables

Name Link
🔨 Latest commit 245070d
🔍 Latest deploy log https://app.netlify.com/sites/aya-rs-docs/deploys/6672d116ca3a530008284a4e

@mergify mergify bot added the aya This is about aya (userspace) label Jun 19, 2024
// /// Result type used for the feature helpers
// pub type Result<T> = std::result::Result<T, FeatureError>;

// fn probe_map_create(map_type: bpf_map_type) -> Result<bool> {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I actually like the idea of having a separate features.rs file. Maybe you could file a prerequisite PR, which moves all is_*_supported functions from bpf.rs to features.rs?

I would be also fine with adding is_ringbuf_supported to bpf.rs and doing this refactor later.

But either way, let's do it without adding commented code. :)

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Was actually a mistake making that 2nd commit. I'll probably close this PR since the scope has changed (see chat) and create a new when I have some working code that's in line with the new proposed solution and your comment

@martinsoees
Copy link
Author

Scope has changed. Closing this and will create a new later with the proposed suggestions.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
aya This is about aya (userspace)
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants