Fix platform-specific compilation for Linux-only features in unix.rs#2410
Open
Ayush-Raj-Chourasia wants to merge 2 commits intoquinn-rs:mainfrom
Open
Fix platform-specific compilation for Linux-only features in unix.rs#2410Ayush-Raj-Chourasia wants to merge 2 commits intoquinn-rs:mainfrom
Ayush-Raj-Chourasia wants to merge 2 commits intoquinn-rs:mainfrom
Conversation
mxinden
reviewed
Oct 5, 2025
Collaborator
There was a problem hiding this comment.
Can you describe why these changes are necessary?
Member
There was a problem hiding this comment.
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")] |
Collaborator
There was a problem hiding this comment.
This now excludes MacOS. Why is IP_RECVTOS not available on MacOS? Note that this works for Firefox on MacOS:
Collaborator
There was a problem hiding this comment.
Comment on lines
+509
to
+513
| #[cfg(all( | ||
| not(any(apple, target_os = "openbsd", target_os = "netbsd", solarish)), | ||
| not(target_os = "linux") | ||
| ))] | ||
| fn recv( |
Collaborator
There was a problem hiding this comment.
Which target_os is not excluded above?
Collaborator
|
Note that our CI already covers several non-Linux unix cases, which work just fine. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
This PR adds conditional compilation guards for Linux-specific features in unix.rs, such as
IP_RECVTOSandmmsghdr, 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.