-
-
Notifications
You must be signed in to change notification settings - Fork 475
Fix platform-specific compilation for Linux-only features in unix.rs #2410
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
base: main
Are you sure you want to change the base?
Fix platform-specific compilation for Linux-only features in unix.rs #2410
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can you describe why these changes are necessary?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
More specifically: what platform(s) are you trying to build for?
// mac and ios do not support IP_RECVTOS on dual-stack sockets :( | ||
// older macos versions also don't have the flag and will error out if we don't ignore it | ||
#[cfg(not(any(target_os = "openbsd", target_os = "netbsd", solarish)))] | ||
#[cfg(target_os = "linux")] |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This now excludes MacOS. Why is IP_RECVTOS
not available on MacOS? Note that this works for Firefox on MacOS:
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
#[cfg(all( | ||
not(any(apple, target_os = "openbsd", target_os = "netbsd", solarish)), | ||
not(target_os = "linux") | ||
))] | ||
fn recv( |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Which target_os
is not excluded above?
This PR adds conditional compilation guards for Linux-specific features in unix.rs, such as
IP_RECVTOS
andmmsghdr
, which are not available on BSD or other non-Linux platforms.#[cfg(target_os = "linux")]
to restrict usage of these features to Linux only.This improves cross-platform compatibility and ensures the crate builds cleanly on non-Linux systems.