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

Enums and booleans require large type declaration for FFI #3

Open
bcelenza opened this issue Sep 5, 2022 · 0 comments
Open

Enums and booleans require large type declaration for FFI #3

bcelenza opened this issue Sep 5, 2022 · 0 comments
Labels
invalid This doesn't seem right

Comments

@bcelenza
Copy link
Owner

bcelenza commented Sep 5, 2022

Example: socket close state

If represented as anything other than a u64, an invalid memory access error is throwing during validation of the BPF program.

pub close_state: u64,

#[derive(Copy, Clone)]
pub enum SocketCloseState {
FIN = 1,
RST = 2,
}

Some related info: foniod/redbpf#150, https://rust-lang.github.io/unsafe-code-guidelines/layout/enums.html

I'm probably just misunderstanding something trivial.

@bcelenza bcelenza changed the title Enums require large type declaration for FFI Enums and booleans require large type declaration for FFI Sep 5, 2022
@bcelenza bcelenza added bug Something isn't working invalid This doesn't seem right and removed bug Something isn't working labels Sep 10, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
invalid This doesn't seem right
Projects
None yet
Development

No branches or pull requests

1 participant