Skip site navigation (1)Skip section navigation (2)
Date:      Fri, 17 Dec 2021 02:56:46 GMT
From:      Kyle Evans <kevans@FreeBSD.org>
To:        src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org
Subject:   git: 849466665811 - main - sysent: move away from allowing all compat options for other ABIs
Message-ID:  <202112170256.1BH2ukFv074482@gitrepo.freebsd.org>

next in thread | raw e-mail | index | archive | help
The branch main has been updated by kevans:

URL: https://cgit.FreeBSD.org/src/commit/?id=849466665811981d2e55201f6901d576d947a745

commit 849466665811981d2e55201f6901d576d947a745
Author:     Kyle Evans <kevans@FreeBSD.org>
AuthorDate: 2021-12-09 04:37:28 +0000
Commit:     Kyle Evans <kevans@FreeBSD.org>
CommitDate: 2021-12-17 02:56:28 +0000

    sysent: move away from allowing all compat options for other ABIs
    
    Notably, the current compat_options only makes sense for native and
    freebsd32 ABIs.  For the others, it just adds cruft. Switch to having
    sets of compat options, and default to the native set.  Setup the other
    ABIs where it doesn't make sense to opt-out of the native set.
    
    This removes some redundant COMPAT_FREEBSD* stuff from Linuxolator bits.
    
    line_expr in makesyscalls.lua is fixed to allow empty strings to be
    specified, since they're harmless.
    
    Reviewed by:    brooks, kib (both earlier version)
    Differential Revision:  https://reviews.freebsd.org/D33356
---
 sys/amd64/linux/syscalls.conf   |  1 +
 sys/amd64/linux32/syscalls.conf |  1 +
 sys/arm64/linux/syscalls.conf   |  1 +
 sys/i386/linux/syscalls.conf    |  1 +
 sys/tools/makesyscalls.lua      | 49 +++++++++++++++++++++++++++--------------
 5 files changed, 37 insertions(+), 16 deletions(-)

diff --git a/sys/amd64/linux/syscalls.conf b/sys/amd64/linux/syscalls.conf
index 29f37920bba6..a47f80444c2a 100644
--- a/sys/amd64/linux/syscalls.conf
+++ b/sys/amd64/linux/syscalls.conf
@@ -9,3 +9,4 @@ syscallprefix="LINUX_SYS_"
 switchname="linux_sysent"
 namesname="linux_syscallnames"
 systrace="linux_systrace_args.c"
+compat_set=""
diff --git a/sys/amd64/linux32/syscalls.conf b/sys/amd64/linux32/syscalls.conf
index 7d096b5a9c64..ce9a437e82e3 100644
--- a/sys/amd64/linux32/syscalls.conf
+++ b/sys/amd64/linux32/syscalls.conf
@@ -9,3 +9,4 @@ syscallprefix="LINUX32_SYS_"
 switchname="linux32_sysent"
 namesname="linux32_syscallnames"
 systrace="linux32_systrace_args.c"
+compat_set=""
diff --git a/sys/arm64/linux/syscalls.conf b/sys/arm64/linux/syscalls.conf
index 29f37920bba6..a47f80444c2a 100644
--- a/sys/arm64/linux/syscalls.conf
+++ b/sys/arm64/linux/syscalls.conf
@@ -9,3 +9,4 @@ syscallprefix="LINUX_SYS_"
 switchname="linux_sysent"
 namesname="linux_syscallnames"
 systrace="linux_systrace_args.c"
+compat_set=""
diff --git a/sys/i386/linux/syscalls.conf b/sys/i386/linux/syscalls.conf
index 29f37920bba6..a47f80444c2a 100644
--- a/sys/i386/linux/syscalls.conf
+++ b/sys/i386/linux/syscalls.conf
@@ -9,3 +9,4 @@ syscallprefix="LINUX_SYS_"
 switchname="linux_sysent"
 namesname="linux_syscallnames"
 systrace="linux_systrace_args.c"
+compat_set=""
diff --git a/sys/tools/makesyscalls.lua b/sys/tools/makesyscalls.lua
index 452924f1eb21..178869d03b0e 100644
--- a/sys/tools/makesyscalls.lua
+++ b/sys/tools/makesyscalls.lua
@@ -56,6 +56,7 @@ local config = {
 	systrace = "systrace_args.c",
 	capabilities_conf = "capabilities.conf",
 	capenabled = {},
+	compat_set = "native",
 	mincompat = 0,
 	abi_type_suffix = "",
 	abi_flags = "",
@@ -201,7 +202,7 @@ local known_flags = {
 	-- Compat flags start from here.  We have plenty of space.
 }
 
--- All compat_options entries should have five entries:
+-- All compat option entries should have five entries:
 --	definition: The preprocessor macro that will be set for this
 --	compatlevel: The level this compatibility should be included at.  This
 --	    generally represents the version of FreeBSD that it is compatible
@@ -212,23 +213,28 @@ local known_flags = {
 --	    used as-is, without "_" or any other character appended.
 --	descr: The description of this compat option in init_sysent.c comments.
 -- The special "stdcompat" entry will cause the other five to be autogenerated.
-local compat_options = {
-	{
-		definition = "COMPAT_43",
-		compatlevel = 3,
-		flag = "COMPAT",
-		prefix = "o",
-		descr = "old",
+local compat_option_sets = {
+	native = {
+		{
+			definition = "COMPAT_43",
+			compatlevel = 3,
+			flag = "COMPAT",
+			prefix = "o",
+			descr = "old",
+		},
+		{ stdcompat = "FREEBSD4" },
+		{ stdcompat = "FREEBSD6" },
+		{ stdcompat = "FREEBSD7" },
+		{ stdcompat = "FREEBSD10" },
+		{ stdcompat = "FREEBSD11" },
+		{ stdcompat = "FREEBSD12" },
+		{ stdcompat = "FREEBSD13" },
 	},
-	{ stdcompat = "FREEBSD4" },
-	{ stdcompat = "FREEBSD6" },
-	{ stdcompat = "FREEBSD7" },
-	{ stdcompat = "FREEBSD10" },
-	{ stdcompat = "FREEBSD11" },
-	{ stdcompat = "FREEBSD12" },
-	{ stdcompat = "FREEBSD13" },
 }
 
+-- compat_options will be resolved to a set from the configuration.
+local compat_options
+
 local function trim(s, char)
 	if s == nil then
 		return nil
@@ -250,7 +256,7 @@ local function process_config(file)
 	-- Alternatively, we could drop the whitespace and instead try to
 	-- use a pattern to strip out the meaty part of the line, but then we
 	-- would need to sanitize the line for potentially special characters.
-	local line_expr = "^([%w%p]+%s*)=(%s*[`\"]?[^\"`]+[`\"]?)"
+	local line_expr = "^([%w%p]+%s*)=(%s*[`\"]?[^\"`]*[`\"]?)"
 
 	if not file then
 		return nil, "No file given"
@@ -1336,6 +1342,17 @@ if configfile ~= nil then
 	end
 end
 
+local compat_set = config['compat_set']
+if compat_set ~= "" then
+	if not compat_option_sets[compat_set] then
+		abort(1, "Undefined compat set: " .. compat_set)
+	end
+
+	compat_options = compat_option_sets[compat_set]
+else
+	compat_options = {}
+end
+
 -- We ignore errors here if we're relying on the default configuration.
 if not config_modified["capenabled"] then
 	config["capenabled"] = grab_capenabled(config['capabilities_conf'],



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?202112170256.1BH2ukFv074482>