git: 202ac0975edc - main - sysent: add a new NORETURN type flag
- Go to: [ bottom of page ] [ top of archives ] [ this month ]
Date: Fri, 08 Aug 2025 09:37:44 UTC
The branch main has been updated by brooks:
URL: https://cgit.FreeBSD.org/src/commit/?id=202ac0975edcc4729e7016a9e9cb921de45e3a70
commit 202ac0975edcc4729e7016a9e9cb921de45e3a70
Author: Brooks Davis <brooks@FreeBSD.org>
AuthorDate: 2025-08-08 09:30:17 +0000
Commit: Brooks Davis <brooks@FreeBSD.org>
CommitDate: 2025-08-08 09:30:17 +0000
sysent: add a new NORETURN type flag
System calls of type NORETURN don't return and their stubs are declare
not to.
Reviewed by: kevans, kib
Differential Revision: https://reviews.freebsd.org/D51673
---
sys/kern/syscalls.master | 1 +
sys/tools/syscalls/core/syscall.lua | 1 +
sys/tools/syscalls/scripts/libsys_h.lua | 8 ++++++--
3 files changed, 8 insertions(+), 2 deletions(-)
diff --git a/sys/kern/syscalls.master b/sys/kern/syscalls.master
index 29f9d9dae390..9329a4213828 100644
--- a/sys/kern/syscalls.master
+++ b/sys/kern/syscalls.master
@@ -51,6 +51,7 @@
; SYSMUX syscall multiplexer. No prototype, argument struct, or
; handler is declared or used. Handled in MD syscall code.
; CAPENABLED syscall is allowed in capability mode
+; NORETURN the syscall does not return
;
; To support programmatic generation of both the default ABI and 32-bit compat
; (freebsd32) we impose a number of restrictions on the types of system calls.
diff --git a/sys/tools/syscalls/core/syscall.lua b/sys/tools/syscalls/core/syscall.lua
index e7e3dc3aac33..277613ec27b7 100644
--- a/sys/tools/syscalls/core/syscall.lua
+++ b/sys/tools/syscalls/core/syscall.lua
@@ -28,6 +28,7 @@ syscall.known_flags = util.set {
-- flags beyond this point are modifiers
"CAPENABLED",
"NOLIB",
+ "NORETURN",
"NOTSTATIC",
"SYSMUX",
}
diff --git a/sys/tools/syscalls/scripts/libsys_h.lua b/sys/tools/syscalls/scripts/libsys_h.lua
index 91349d5dc870..8c1993ecf683 100755
--- a/sys/tools/syscalls/scripts/libsys_h.lua
+++ b/sys/tools/syscalls/scripts/libsys_h.lua
@@ -76,8 +76,12 @@ function libsys_h.generate(tbl, config, fh)
for _, v in pairs(s) do
if print_decl(v) then
- gen:write(string.format("%s __sys_%s(%s);\n",
- v.ret, v.name, v.argstr_type_var))
+ local ret_attr = "";
+ if v.type.NORETURN then
+ ret_attr = "_Noreturn "
+ end
+ gen:write(string.format("%s%s __sys_%s(%s);\n",
+ ret_attr, v.ret, v.name, v.argstr_type_var))
end
end