-
-
Notifications
You must be signed in to change notification settings - Fork 57
Support for GNU Make jobserver #94
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
Closed
Closed
Changes from all commits
Commits
Show all changes
11 commits
Select commit
Hold shift + click to select a range
58cf674
support for gnu make jobserver
capezotte b582346
close jobserver fds before exec, return tokens on normal exit
capezotte 2a9dbf6
install a signal handler for returning tokens
capezotte 32900a7
Merge branch 'michaelforney:master' into jobserver
capezotte acbd532
avoid calling printf in a signal handler
capezotte 1967630
support fifo: jobserver authentication
capezotte 2c0a5fa
make parsejobserver more straightforward
capezotte 07316b1
fix oversight in option handling + style
capezotte 17926b6
use -j from makeflags as maxjobs
capezotte 1d9f35f
use a single poll
capezotte 383db80
misc fixes
capezotte File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
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
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
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
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.
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.
There is a race condition here:
pollreturns POLLINpolldetectedreadblocksThe solution used by GNU Make is complex and relies on trapping SIGCHLD and dup-ing the file descriptor. It's complicated and it's why I just went for reading the jobserver file descriptor in a separate thread instead.
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.
I'm not even sure GNU Make's solution is 100% robust without an extra
(void)alarm(1);, or only starting a new process as an absolute last resort.I really have to rethink this implementation.
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.
After reading that paper about the GNU make implementation, I'm convinced that we must use threads (or some sort of async I/O) to implement this correctly on samurai. The
SIGCHLD/EBADFapproach they use is clever, but won't work for us, since we buffer the output from jobs to avoid it getting jumbled.The main issue is that you cannot predict whether a read on the jobserver fd will block or not. It doesn't matter for make since if it blocks, they have nothing to do anyway until a child exits, which can conveniently interrupt the read via
SIGCHLD. samurai follows ninja in that it buffers job output, so to do the same trick we'd need the jobserver read to get interrupted when any of the pipes to jobs become readable.Because of this, I'm going to close this PR in favor of #104. Thanks for your work getting started on this.