sysent: add a NOLIB modifer to prevent stub generation

The yield system call has long existed, but never had a stub.  Replace
the hardcoded checks for it in libsys_h.lua and syscalls_map.lua and
stop inserting it into MIASM (requiring libsys/Makefile.sys to disable
the stub).

(This seems like overkill, but I've got another case in CheriBSD so this
reduces my diff appreciably.)

Reviewed by:	emaste
Pull Request:	https://github.com/freebsd/freebsd-src/pull/1503
This commit is contained in:
Brooks Davis 2024-10-30 22:48:49 +00:00
parent 2ea829e3ab
commit bbc0f33b13
5 changed files with 7 additions and 5 deletions

View File

@ -46,6 +46,7 @@
; NOPROTO same as STD except do not create structure or
; function prototype in sys/sysproto.h. Does add a
; definition to syscall.h besides adding a sysent.
; NOLIB don't create stubs in libc or libsys
; NOTSTATIC syscall is loadable
; SYSMUX syscall multiplexer. No prototype, argument struct, or
; handler is declared or used. Handled in MD syscall code.
@ -1679,7 +1680,7 @@
_In_opt_ _Contains_ptr_ struct osigevent *sig
);
}
321 AUE_NULL STD|CAPENABLED {
321 AUE_NULL STD|CAPENABLED|NOLIB {
int yield(void);
}
322 AUE_NULL OBSOL thr_sleep

View File

@ -27,6 +27,7 @@ syscall.known_flags = util.set {
-- flags beyond this point are modifiers
"CAPENABLED",
"NOLIB",
"NOTSTATIC",
"SYSMUX",
}

View File

@ -31,7 +31,7 @@ function libsys_h.generate(tbl, config, fh)
local print_decl = function (sc)
return sc:native() and not sc.type.NODEF and
not sc.type.SYSMUX and sc.name ~= "yield"
not sc.type.NOLIB and not sc.type.SYSMUX
end
-- Bind the generator to the parameter file.

View File

@ -44,7 +44,7 @@ function syscall_mk.generate(tbl, config, fh)
for _, v in pairs(s) do
local c = v:compatLevel()
idx = idx + 1
if v:native() and not v.type.NODEF then
if v:native() and not v.type.NODEF and not v.type.NOLIB then
if idx >= size then
-- At last system call, no backslash.
gen:write(string.format("\t%s.o\n", v:symbol()))
@ -53,7 +53,7 @@ function syscall_mk.generate(tbl, config, fh)
gen:write(string.format("\t%s.o \\\n", v:symbol()))
end
-- Handle compat (everything >= FREEBSD3):
elseif c >= 7 and not v.type.NODEF then
elseif c >= 7 and not v.type.NODEF and not v.type.NOLIB then
if idx >= size then
-- At last system call, no backslash.
gen:write(string.format("\t%s.o\n", v:symbol()))

View File

@ -38,7 +38,7 @@ function syscalls_map.generate(tbl, config, fh)
for _, v in pairs(s) do
--print("num " .. v.num .. " name " .. v.name)
if v:native() and not v.type.NODEF and v.name ~= "yield" then
if v:native() and not v.type.NODEF and not v.type.NOLIB then
if v.name ~= "exit" and v.name ~= "vfork" then
gen:write(string.format("\t_%s;\n", v.name))
end