diff options
author | Paul Smith <psmith@gnu.org> | 2022-08-02 18:07:27 -0400 |
---|---|---|
committer | Paul Smith <psmith@gnu.org> | 2022-08-02 23:36:35 -0400 |
commit | 7ad2593b2d2bb5b9332f4444d8bf93ac6f958bc6 (patch) | |
tree | 9989e5d7146c13eb71b608758bec964c1ef949cc /NEWS | |
parent | 09cce75c308a6e7ae0f3635724d2ae87e72f9800 (diff) | |
download | make-git-7ad2593b2d2bb5b9332f4444d8bf93ac6f958bc6.tar.gz |
Support implementing the jobserver using named pipes
Using anonymous pipes for jobserver support has some advantages:
for example there is nothing on disk that needs to be cleaned up.
However it has many obscure problems, related to the fact that in
order for it to work we need to ensure these resources are properly
passed through to child processes that want to use the jobserver.
At the same time we don't want to pass the pipe to process which
DON'T know about the jobserver.
Other processes can open file descriptors which we then think are
our jobserver, but aren't. And, we open the pipe file descriptors
in blocking mode which doesn't work for all users.
See issues such as SV 57178, SV 57242, and SV 62397
To avoid these issues, use named pipes (on systems where they are
available) instead of anonoymous pipes. This simplifies many things:
we never need to pass open file descriptors to our children; they
can open the jobserver named pipe. We don't need to worry about
recursive vs. non-recursive children. Users don't have to "pass
through" the resources if they are invoking sub-makes. Each child
can open its own file descriptor and set blocking as needed.
The downside is the named pipe exists on disk and so must be cleaned
up when the "top-level" make instance exits.
In order to allow make to continue to be used in build systems where
older versions of GNU make, or other tools that want to use the
jobserver, but don't understand named pipes, introduce a new option
--jobserver-style that allows the user to choose anonymous pipes.
* NEWS: Announce the change and the --jobserver-style option.
* doc/make.1: Add --jobserver-style documentation.
* doc/make.texi (Special Variables): Add missing items to .FEATURES.
(Options Summary): Add --jobserver-style.
(POSIX Jobserver): Named pipes, changes to --jobserver-auth, and the
--jobserver-style option.
(Windows Jobserver): Document --jobserver-style for Windows.
* configure.ac: Check for mkfifo.
* src/config.h-vms.template: Undefined HAVE_MKFIFO.
* src/config.h.W32.template: Ditto.
* src/main.c: Add jobserver-style as a new command line option.
(main): Add jobserver-fifo to .FEATURES if supported. Pass the style
option to jobserver_setup().
* src/os.h (jobserver_setup): Accept a style string option.
* src/posixos.c (enum js_type): Enumeration of the jobserver style.
(js_type): Which style we are currently using.
(fifo_name): The path to the named pipe (if in use).
(jobserver_setup): If no style is given, or "fifo" is given, set up a
named pipe: get a temporary file and use mkfifo() on it, then open it
for reading and writing. If something fails fall back to anonymous
pipes.
(jobserver_parse_auth): Parse jobserver-auth to determine the style.
If we are using a named pipe, open it. If we're using anonymous pipes
ensure they're valid as before.
(jobserver_get_invalid_auth): Don't invalidate the jobserver when
using named pipes.
(jobserver_clear): Clean up memory used for named pipes.
(jobserver_acquire_all): Unlink the named pipe when done.
* src/w32/w32os.c (jobserver_setup): Check the style argument.
* tests/scripts/features/jobserver: Use --jobserver-style to test
the anonymous pipe behavior, and also test named pipe/semaphore
behavior. Check invalid jobserver-style options.
* tests/scripts/functions/shell: Use --jobserver-style to test the
anonymous pipe behavior, and also test named pipe/semaphore
behavior.
Diffstat (limited to 'NEWS')
-rw-r--r-- | NEWS | 13 |
1 files changed, 13 insertions, 0 deletions
@@ -74,6 +74,19 @@ https://sv.gnu.org/bugs/index.php?group=make&report_id=111&fix_release_id=109&se described in the makefile. Implementation provided by Sergei Trofimovich <siarheit@google.com> +* New feature: The --jobserver-style command line option and named pipes + A new jobserver method is used on systems where mkfifo(3) is supported. + This solves a number of obscure issues related to using the jobserver + and recursive invocations of GNU make. This change means that sub-makes + will connect to the jobserver even if they are not marked as recursive. + It also means that other tools that want to participate in the jobserver + will need to be enhanced as described in the GNU make manual. + You can force GNU make to use the simple pipe-based jobserver (perhaps if + you are integrating with other tools or older versions of GNU make) by + adding the '--jobserver-style=pipe' option to the command line of the + top-level invocation of GNU make, or via MAKEFLAGS or GNUMAKEFLAGS. + To detect this change search for 'jobserver-fifo' in the .FEATURES variable. + * GNU make has sometimes chosen unexpected, and sub-optimal, chains of implicit rules due to the definition of "ought to exist" in the implicit rule search algorithm, which considered any prerequisite mentioned in the |