-
Notifications
You must be signed in to change notification settings - Fork 250
Add cygwin support #568
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: master
Are you sure you want to change the base?
Add cygwin support #568
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 we add something to the CI to ensure it keeps working?
It actually doesn't work all the time, because of bugs of cygwin. To be specific, the test |
The maintainer of cygwin told me a workaround for the test |
@Thomasdezeeuw ping? |
Could you review this PR again? @Thomasdezeeuw |
#[cfg(target_os = "cygwin")] | ||
listener.set_no_peercred().unwrap(); | ||
listener.bind(&addr).unwrap(); | ||
listener.listen(10).unwrap(); |
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.
The cygwin thread you shared says that this solution is a "kludge". It sounds like it's not intended that you work around this with SO_PEERCRED
.
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.
Well, it's designed for this case, but not recommended. Should I remove it?
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.
Actually I prefer adding this set_no_peercred
. Many programs, including C & Rust programs, assume the common behavior that connect()
doesn't block on Unix sockets. This API is designed for the case as a workaround. I think it would be useful to port some Rust programs to Cygwin...
This PR makes it compile on cygwin.