Skip to content

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

Open
wants to merge 5 commits into
base: master
Choose a base branch
from
Open

Conversation

Berrysoft
Copy link
Contributor

This PR makes it compile on cygwin.

Copy link
Collaborator

@Thomasdezeeuw Thomasdezeeuw left a 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?

@Berrysoft
Copy link
Contributor Author

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 unix hangs. Is it OK to ignore this test on cygwin and add a job to CI?

@Berrysoft
Copy link
Contributor Author

The maintainer of cygwin told me a workaround for the test unix. I have commited it.

@Berrysoft
Copy link
Contributor Author

@Thomasdezeeuw ping?

@Berrysoft
Copy link
Contributor Author

Could you review this PR again? @Thomasdezeeuw

Comment on lines +574 to 577
#[cfg(target_os = "cygwin")]
listener.set_no_peercred().unwrap();
listener.bind(&addr).unwrap();
listener.listen(10).unwrap();
Copy link
Collaborator

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.

Copy link
Contributor Author

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?

Copy link
Contributor Author

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...

@Berrysoft Berrysoft requested a review from Darksonn May 11, 2025 14:19
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants