mirror of
https://mirrors.bfsu.edu.cn/git/linux.git
synced 2024-11-11 04:18:39 +08:00
scripts: support GNU make 4.4 in jobserver-exec
Starting with GNU make 4.4, --jobserver-auth newly uses named pipe (fifo) instead of part of opened file descriptors: https://www.gnu.org/software/make/manual/html_node/POSIX-Jobserver.html Support also the new format. Signed-off-by: Martin Liska <mliska@suse.cz> Signed-off-by: Masahiro Yamada <masahiroy@kernel.org>
This commit is contained in:
parent
aedee9e8d9
commit
8c0089882a
@ -26,11 +26,20 @@ try:
|
|||||||
# If the MAKEFLAGS variable contains multiple instances of the
|
# If the MAKEFLAGS variable contains multiple instances of the
|
||||||
# --jobserver-auth= option, the last one is relevant.
|
# --jobserver-auth= option, the last one is relevant.
|
||||||
fds = opts[-1].split("=", 1)[1]
|
fds = opts[-1].split("=", 1)[1]
|
||||||
reader, writer = [int(x) for x in fds.split(",", 1)]
|
|
||||||
# Open a private copy of reader to avoid setting nonblocking
|
# Starting with GNU Make 4.4, named pipes are used for reader and writer.
|
||||||
# on an unexpecting process with the same reader fd.
|
# Example argument: --jobserver-auth=fifo:/tmp/GMfifo8134
|
||||||
reader = os.open("/proc/self/fd/%d" % (reader),
|
_, _, path = fds.partition('fifo:')
|
||||||
os.O_RDONLY | os.O_NONBLOCK)
|
|
||||||
|
if path:
|
||||||
|
reader = os.open(path, os.O_RDONLY | os.O_NONBLOCK)
|
||||||
|
writer = os.open(path, os.O_WRONLY)
|
||||||
|
else:
|
||||||
|
reader, writer = [int(x) for x in fds.split(",", 1)]
|
||||||
|
# Open a private copy of reader to avoid setting nonblocking
|
||||||
|
# on an unexpecting process with the same reader fd.
|
||||||
|
reader = os.open("/proc/self/fd/%d" % (reader),
|
||||||
|
os.O_RDONLY | os.O_NONBLOCK)
|
||||||
|
|
||||||
# Read out as many jobserver slots as possible.
|
# Read out as many jobserver slots as possible.
|
||||||
while True:
|
while True:
|
||||||
|
Loading…
Reference in New Issue
Block a user