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: Fix is_perf_link_supported #523

Merged
merged 1 commit into from
Feb 13, 2023
Merged

Conversation

dave-tucker
Copy link
Member

This was mistakenly comparing the exit code of the syscall, which is always -1 and not the corresponding error-code. Added unit tests to ensure we don't regress.

Signed-off-by: Dave Tucker dave@dtucker.co.uk

@netlify
Copy link

netlify bot commented Feb 13, 2023

Deploy Preview for aya-rs-docs ready!

Name Link
🔨 Latest commit ce79de7
🔍 Latest deploy log https://app.netlify.com/sites/aya-rs-docs/deploys/63ea4b2de164d60008fa982f
😎 Deploy Preview https://deploy-preview-523--aya-rs-docs.netlify.app/user/src/aya/sys/bpf.rs
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.

To edit notification comments on pull requests, go to your Netlify site settings.

@dave-tucker
Copy link
Member Author

Before:

bpf(BPF_LINK_CREATE, {link_create={prog_fd=11, target_fd=-1, attach_type=BPF_PERF_EVENT, flags=0, perf_event={bpf_cookie=0}}}, 144) = -1 EBADF (Bad file descriptor)
[2023-02-13T14:16:21Z DEBUG aya::bpf] BPF Feature Detection: Features {
        bpf_name: true,
        bpf_perf_link: false,
        btf: Some(
            BtfFeatures {
                btf_func: true,
                btf_func_global: true,
                btf_datasec: true,
                btf_float: true,
                btf_decl_tag: true,
                btf_type_tag: true,
            },
        ),
    }

After:

bpf(BPF_LINK_CREATE, {link_create={prog_fd=11, target_fd=-1, attach_type=BPF_PERF_EVENT, flags=0, perf_event={bpf_cookie=0}}}, 144) = -1 EBADF (Bad file descriptor)
[2023-02-13T14:36:22Z DEBUG aya::bpf] BPF Feature Detection: Features {
       bpf_name: true,
       bpf_perf_link: true,
       btf: Some(
           BtfFeatures {
               btf_func: true,
               btf_func_global: true,
               btf_datasec: true,
               btf_float: true,
               btf_decl_tag: true,
               btf_type_tag: true,
           },
       ),
   }

This was mistakenly comparing the exit code of the syscall, which is
always -1 and not the corresponding error-code. Added unit tests to
ensure we don't regress.

Signed-off-by: Dave Tucker <dave@dtucker.co.uk>
@dave-tucker
Copy link
Member Author

Will merge on green since this is a smol bugfix 🤏 🐛

@dave-tucker dave-tucker merged commit 56c1438 into aya-rs:main Feb 13, 2023
@dave-tucker dave-tucker added fix A PR that is a small change or fixes a bug aya This is about aya (userspace) labels Feb 23, 2023
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) fix A PR that is a small change or fixes a bug
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant