On Sat, Feb 13, 2016 at 09:51:41PM -0800, Manoj Srivastava wrote: > On Sat, Mar 28 2015, Josh Triplett wrote: > > Package: make > > Version: 4.0-8.1 > > Severity: wishlist > > > The --jobserver-fds option, and the jobserver pipe used to handle -j > > correctly in recursive make invocations, ought to have documentation in > > the manpage. > > This is not a user facing public interface, so I am not sure it > belongs in the manual. Did you have a use for this information?
Yes: trying to build a program that, like gcc's LTO linker, can integrate with make's jobserver. gcc's LTO linker can run multiple threads in parallel, and can use make's jobserver pipe to manage how many threads it runs at a time. If you pass -flto=jobserv to gcc, and tell make to treat gcc as a sub-make, gcc will respect make's jobserver pipe when spawning its threads. That seems like a really good idea for any program used as part of a build process and capable of running multiple parallel threads for performance. And conversely, any other build system capable of spawning off other programs and running multiple jobs in parallel could follow the same convention, to interoperate with make. So, I wanted to learn how to build a program that could interoperate with make like GCC did. I figured out most of the details, but the interface has some subtleties. For instance, when make spawns a sub-make (or any other program launched with '+' and acting like a sub-make), the sub-make can always run one "free" job in addition to one job per byte read from the jobserver pipe, and should not write back a byte when that "free" job completes, because the parent make (or some ancestor make) will have consumed a byte (or used its free job) to run the sub-make. This kind of subtlety makes the interface worth documenting. Some third-party articles document the jobserver, but make's own manpage ought to do so as well. - Josh Triplett