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

monitor-fds: Fix on macOS. #1872

Merged
merged 1 commit into from Feb 15, 2018
Merged

monitor-fds: Fix on macOS. #1872

merged 1 commit into from Feb 15, 2018

Conversation

shlevy
Copy link
Member

@shlevy shlevy commented Feb 14, 2018

Fixes #1871.

@shlevy
Copy link
Member Author

shlevy commented Feb 14, 2018

Testing this on my box now, but based on the simplified tests I fully expect it to work.

fds[0].events = 0;
/* This shouldn't be necessary, but macOS doesn't seem to
like a zeroed out events field.
See https://openradar.appspot.com/radar?id=5047895313088512
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Lovely, thanks!

@shlevy
Copy link
Member Author

shlevy commented Feb 14, 2018

Ugh, hitting the assertion on the next line, digging in...

@shlevy
Copy link
Member Author

shlevy commented Feb 14, 2018

poll is timing out even with a -1 timeout. Going to try select...

@shlevy
Copy link
Member Author

shlevy commented Feb 14, 2018

Seems related... curl/curl#1057

@shlevy shlevy closed this Feb 14, 2018
@shlevy shlevy reopened this Feb 14, 2018
@shlevy shlevy changed the title monitor-fds: Fix on macOS. WIP monitor-fds: Fix on macOS. Feb 14, 2018
@shlevy shlevy changed the title WIP monitor-fds: Fix on macOS. monitor-fds: Fix on macOS. Feb 14, 2018
@shlevy
Copy link
Member Author

shlevy commented Feb 14, 2018

OK, this is tested and working. Ugly, but so is the problem domain.

fds[0].events = POLLHUP;
auto count = poll(fds, 1, -1);
if (count == -1) abort(); // can't happen
if (count == 0) continue; // shouldn't happen, but macOS is terrbile
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We may want to insert a delay here if this turns out to cause lots of spinning.

@edolstra edolstra merged commit d26b71f into NixOS:master Feb 15, 2018
@shlevy shlevy deleted the macOS-poll-fix branch February 15, 2018 19:58
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.

None yet

3 participants