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

Mismatch between flag type and function argument for recvmmsg #2945

Closed
ozgb opened this issue Oct 7, 2022 · 1 comment · Fixed by #2963
Closed

Mismatch between flag type and function argument for recvmmsg #2945

ozgb opened this issue Oct 7, 2022 · 1 comment · Fixed by #2963
Labels
C-bug Category: bug

Comments

@ozgb
Copy link

ozgb commented Oct 7, 2022

The function recvmmsg for musl and emscripten has argument type c_uint for flags, but the flag types as defined in this package are c_int.

Problematic function definitions here:


flags: ::c_uint,

I encounted this when compiling a dependency that used libc:

#18 580.4    Compiling solana-streamer v1.10.40
#18 580.8 error[E0308]: mismatched types
#18 580.8   --> /root/.cargo/registry/src/git.luolix.top-1ecc6299db9ec823/solana-streamer-1.10.40/src/recvmmsg.rs:99:70
#18 580.8    |
#18 580.8 99 |         unsafe { libc::recvmmsg(sock_fd, &mut hdrs[0], count as u32, MSG_WAITFORONE, &mut ts) };
#18 580.8    |                                                                      ^^^^^^^^^^^^^^ expected `u32`, found `i32`
#18 580.8    |
#18 580.8 help: you can convert an `i32` to a `u32` and panic if the converted value doesn't fit
#18 580.8    |
#18 580.8 99 |         unsafe { libc::recvmmsg(sock_fd, &mut hdrs[0], count as u32, MSG_WAITFORONE.try_into().unwrap(), &mut ts) };
#18 580.8    |                                                                                    ++++++++++++++++++++
#18 580.8 
#18 580.9 For more information about this error, try `rustc --explain E0308`.
#18 580.9 error: could not compile `solana-streamer` due to previous error
#18 580.9 warning: build failed, waiting for other jobs to finish...
#18 601.8 error: build failed

MSG_WAITFORONE is defined as a c_int:

pub const MSG_WAITFORONE: ::c_int = 0x10000;

@ozgb ozgb added the C-bug Category: bug label Oct 7, 2022
devnexen added a commit to devnexen/libc that referenced this issue Oct 14, 2022
bors added a commit that referenced this issue Oct 23, 2022
linux fixes recvmmsg flags type for musl/emscripten.

closes #2945
@bors bors closed this as completed in 00204b0 Oct 23, 2022
@niluxv
Copy link
Contributor

niluxv commented Oct 25, 2022

I guess this issue needs to be reopend.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
C-bug Category: bug
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants