diff --git a/sys/amd64/linux/syscalls.conf b/sys/amd64/linux/syscalls.conf --- a/sys/amd64/linux/syscalls.conf +++ b/sys/amd64/linux/syscalls.conf @@ -9,3 +9,4 @@ 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 --- a/sys/amd64/linux32/syscalls.conf +++ b/sys/amd64/linux32/syscalls.conf @@ -9,3 +9,4 @@ 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 --- a/sys/arm64/linux/syscalls.conf +++ b/sys/arm64/linux/syscalls.conf @@ -9,3 +9,4 @@ 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 --- a/sys/i386/linux/syscalls.conf +++ b/sys/i386/linux/syscalls.conf @@ -9,3 +9,4 @@ 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 --- a/sys/tools/makesyscalls.lua +++ b/sys/tools/makesyscalls.lua @@ -56,6 +56,7 @@ systrace = "systrace_args.c", capabilities_conf = "capabilities.conf", capenabled = {}, + compat_set = "native", mincompat = 0, abi_type_suffix = "", abi_flags = "", @@ -201,7 +202,7 @@ -- 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 @@ -- 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 @@ -- 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 @@ 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'],