Commit 4920323c authored by Kees Cook's avatar Kees Cook Committed by Jonathan Corbet
Browse files

docs, parallelism: Fix failure path and add comment



Rasmus noted that the failure path didn't correctly exit. Fix this and
add another comment about GNU Make's job server environment variable
names over time.

Reported-by: default avatarRasmus Villemoes <linux@rasmusvillemoes.dk>
Link: https://lore.kernel.org/lkml/eb25959a-9ec4-3530-2031-d9d716b40b20@rasmusvillemoes.dk


Signed-off-by: default avatarKees Cook <keescook@chromium.org>
Link: https://lore.kernel.org/r/20191121205929.40371-2-keescook@chromium.org


Signed-off-by: default avatarJonathan Corbet <corbet@lwn.net>
parent e3fedd57
Loading
Loading
Loading
Loading
+3 −0
Original line number Original line Diff line number Diff line
@@ -24,6 +24,8 @@ try:
	flags = os.environ['MAKEFLAGS']
	flags = os.environ['MAKEFLAGS']


	# Look for "--jobserver=R,W"
	# Look for "--jobserver=R,W"
	# Note that GNU Make has used --jobserver-fds and --jobserver-auth
	# so this handles all of them.
	opts = [x for x in flags.split(" ") if x.startswith("--jobserver")]
	opts = [x for x in flags.split(" ") if x.startswith("--jobserver")]


	# Parse out R,W file descriptor numbers and set them nonblocking.
	# Parse out R,W file descriptor numbers and set them nonblocking.
@@ -53,6 +55,7 @@ os.write(writer, jobs)
# If the jobserver was (impossibly) full or communication failed, use default.
# If the jobserver was (impossibly) full or communication failed, use default.
if len(jobs) < 1:
if len(jobs) < 1:
	print(default)
	print(default)
	sys.exit(0)


# Report available slots (with a bump for our caller's reserveration).
# Report available slots (with a bump for our caller's reserveration).
print(len(jobs) + 1)
print(len(jobs) + 1)