aboutsummaryrefslogtreecommitdiff
path: root/sys/tools/syscalls
diff options
context:
space:
mode:
authorBrooks Davis <brooks@FreeBSD.org>2025-08-08 09:30:16 +0000
committerBrooks Davis <brooks@FreeBSD.org>2025-08-08 09:30:16 +0000
commite7e964cb2ebde11593786a28cea0238d9a6e24c3 (patch)
treeff222b2b7075e6fd66474dd686670a36e5606d88 /sys/tools/syscalls
parentfd4cdc438b7740007b06ea97431cc724e9aae185 (diff)
syscalls: normalize _exit(2) declerations
exit(3) is implemented by the runtime and performs a number of shutdown actions before ultimately calling _exit(2) to terminate the program. We historically named the syscall table entry `exit` rather than `_exit`, but this requires special handling in libc/libsys to cause the `_exit` symbol to exist while implementing `exit` in libc. Declare the syscall as `_exit` and flow that through the system. Because syscall(SYS_exit, code) is fairly widely used, allow a configured extra line in syscall.h to define SYS_exit to SYS__exit. I've found no external uses of __sys_exit() so I've not bothered to create a compatability version of this private symbol. Reviewed by: imp, kib, emaste Differential Revision: https://reviews.freebsd.org/D51672
Diffstat (limited to 'sys/tools/syscalls')
-rw-r--r--sys/tools/syscalls/config.lua1
-rwxr-xr-xsys/tools/syscalls/scripts/syscall_h.lua4
-rwxr-xr-xsys/tools/syscalls/scripts/syscalls_map.lua2
3 files changed, 6 insertions, 1 deletions
diff --git a/sys/tools/syscalls/config.lua b/sys/tools/syscalls/config.lua
index fcf4c2217959..91a8a5af68dd 100644
--- a/sys/tools/syscalls/config.lua
+++ b/sys/tools/syscalls/config.lua
@@ -24,6 +24,7 @@ local util = require("tools.util")
local config = {
sysnames = "syscalls.c",
syshdr = "../sys/syscall.h",
+ syshdr_extra = nil;
sysmk = "/dev/null",
syssw = "init_sysent.c",
systrace = "systrace_args.c",
diff --git a/sys/tools/syscalls/scripts/syscall_h.lua b/sys/tools/syscalls/scripts/syscall_h.lua
index 5f8d8fb66889..d05a1799935b 100755
--- a/sys/tools/syscalls/scripts/syscall_h.lua
+++ b/sys/tools/syscalls/scripts/syscall_h.lua
@@ -38,6 +38,10 @@ function syscall_h.generate(tbl, config, fh)
-- Write the generated preamble.
gen:preamble("System call numbers.")
+ if config.syshdr_extra then
+ gen:write(string.format("%s\n\n", config.syshdr_extra))
+ end
+
for _, v in pairs(s) do
local c = v:compatLevel()
if v.num > max then
diff --git a/sys/tools/syscalls/scripts/syscalls_map.lua b/sys/tools/syscalls/scripts/syscalls_map.lua
index 52c3b294e338..dfd61ae75bc0 100755
--- a/sys/tools/syscalls/scripts/syscalls_map.lua
+++ b/sys/tools/syscalls/scripts/syscalls_map.lua
@@ -39,7 +39,7 @@ function syscalls_map.generate(tbl, config, fh)
for _, v in pairs(s) do
gen:write(v.prolog)
if v:native() and not v.type.NODEF and not v.type.NOLIB then
- if v.name ~= "exit" and v.name ~= "vfork" then
+ if v.name ~= "_exit" and v.name ~= "vfork" then
gen:write(string.format("\t_%s;\n", v.name))
end
gen:write(string.format("\t__sys_%s;\n", v.name))