summaryrefslogtreecommitdiff
path: root/sys/tools
diff options
context:
space:
mode:
authorKyle Evans <kevans@FreeBSD.org>2020-01-10 18:22:14 +0000
committerKyle Evans <kevans@FreeBSD.org>2020-01-10 18:22:14 +0000
commit554f71e2b336668acf07527ef09bc11220eaf1a5 (patch)
treeccbdca711b619b78d91ac373be23034bb9bd783b /sys/tools
parent525c896ba863e4779ce0a4ac9b5e16b03e273f37 (diff)
downloadsrc-test2-554f71e2b336668acf07527ef09bc11220eaf1a5.tar.gz
src-test2-554f71e2b336668acf07527ef09bc11220eaf1a5.zip
makesyscalls.lua: generate all files in /tmp, write into place at the end
This makes makesyscalls.lua more parallel-friendly, or at least not as hostile to the idea. We get into situations where we're running parallel if we end up with MAKE_JOBS>1 entering any of the sysent targets, since each output file is recognized a distinct build step that needs to be executed. Another commit will add some .ORDER to further improve the situation. Reported by: jhb Reviewed by: brooks Differential Revision: https://reviews.freebsd.org/D23098
Notes
Notes: svn path=/head/; revision=356603
Diffstat (limited to 'sys/tools')
-rw-r--r--sys/tools/makesyscalls.lua36
1 files changed, 23 insertions, 13 deletions
diff --git a/sys/tools/makesyscalls.lua b/sys/tools/makesyscalls.lua
index 566ce5bafc51..286230cb13a1 100644
--- a/sys/tools/makesyscalls.lua
+++ b/sys/tools/makesyscalls.lua
@@ -66,13 +66,13 @@ local config_modified = {}
local cleantmp = true
local tmpspace = "/tmp/sysent." .. unistd.getpid() .. "/"
--- These ones we'll open in place
-local config_files_needed = {
+local output_files = {
"sysnames",
"syshdr",
"sysmk",
"syssw",
"systrace",
+ "sysproto",
}
-- These ones we'll create temporary files for; generation purposes.
@@ -1158,9 +1158,9 @@ for _, v in ipairs(temp_files) do
files[v] = io.open(tmpname, "w+")
end
-
-for _, v in ipairs(config_files_needed) do
- files[v] = io.open(config[v], "w+")
+for _, v in ipairs(output_files) do
+ local tmpname = tmpspace .. v
+ files[v] = io.open(tmpname, "w+")
end
-- Write out all of the preamble bits
@@ -1343,18 +1343,28 @@ write_line("systraceret", [[
write_line("syssw", read_file("sysinc"))
write_line("syssw", read_file("sysent"))
-local fh = io.open(config["sysproto"], "w+")
-fh:write(read_file("sysarg"))
-fh:write(read_file("sysdcl"))
+write_line("sysproto", read_file("sysarg"))
+write_line("sysproto", read_file("sysdcl"))
for _, v in pairs(compat_options) do
- fh:write(read_file(v["tmp"]))
- fh:write(read_file(v["dcltmp"]))
+ write_line("sysproto", read_file(v["tmp"]))
+ write_line("sysproto", read_file(v["dcltmp"]))
end
-fh:write(read_file("sysaue"))
-fh:write(read_file("sysprotoend"))
-fh:close()
+write_line("sysproto", read_file("sysaue"))
+write_line("sysproto", read_file("sysprotoend"))
write_line("systrace", read_file("systracetmp"))
write_line("systrace", read_file("systraceret"))
+for _, v in ipairs(output_files) do
+ local target = config[v]
+ if target ~= "/dev/null" then
+ local fh = io.open(target, "w+")
+ if fh == nil then
+ abort(1, "Failed to open '" .. target .. "'")
+ end
+ fh:write(read_file(v))
+ fh:close()
+ end
+end
+
cleanup()