Lines Matching +full:os +full:- +full:initiated
2 # SPDX-License-Identifier: GPL-2.0+
11 A "normal" jobserver task, like the one initiated by a make subrocess would do:
13 - open read/write file descriptors to communicate with the job server;
14 - ask for one slot by calling:
15 claim = os.read(reader, 1)
16 - when the job finshes, call:
17 os.write(writer, b"+") # os.write(writer, claim)
23 call equivalent to make -j$((claim+1)), e.g. having a parent make creating
27 limit established by the initial make -j$n_proc call.
30 https://www.gnu.org/software/make/manual/html_node/POSIX-Jobserver.html#POSIX-Jobserver
34 import os
43 - open(): reserves all slots;
44 - close(): method returns all used slots back to make;
45 - run(): executes a command setting PARALLELISM=<available slots jobs + 1>
64 flags = os.environ["MAKEFLAGS"]
65 # Look for "--jobserver=R,W"
66 # Note that GNU Make has used --jobserver-fds and --jobserver-auth
68 opts = [x for x in flags.split(" ") if x.startswith("--jobserver")]
72 # --jobserver-auth= option, the last one is relevant.
73 fds = opts[-1].split("=", 1)[1]
77 # Example argument: --jobserver-auth=fifo:/tmp/GMfifo8134
81 self.reader = os.open(path, os.O_RDONLY | os.O_NONBLOCK)
82 self.writer = os.open(path, os.O_WRONLY)
87 self.reader = os.open("/proc/self/fd/%d" % (self.reader),
88 os.O_RDONLY | os.O_NONBLOCK)
93 slot = os.read(self.reader, 8)
101 os.write(self.writer, self.jobs)
123 os.write(self.writer, self.jobs)
143 # top-level "-jN" argument) and there were no other failures. Otherwise
147 os.environ["PARALLELISM"] = str(self.claim)