git: 26061e4e542d - main - kern: add kern_nosys() and use it instead of type-punning the sys_nosys() arg
- Go to: [ bottom of page ] [ top of archives ] [ this month ]
Date: Sun, 06 Jul 2025 21:14:36 UTC
The branch main has been updated by kib:
URL: https://cgit.FreeBSD.org/src/commit/?id=26061e4e542d220c577fb3437a9a9f108dc27698
commit 26061e4e542d220c577fb3437a9a9f108dc27698
Author: Konstantin Belousov <kib@FreeBSD.org>
AuthorDate: 2025-07-06 12:18:11 +0000
Commit: Konstantin Belousov <kib@FreeBSD.org>
CommitDate: 2025-07-06 21:14:14 +0000
kern: add kern_nosys() and use it instead of type-punning the sys_nosys() arg
Sponsored by: The FreeBSD Foundation
MFC after: 1 week
---
sys/kern/kern_sig.c | 9 +++++++--
sys/kern/kern_syscalls.c | 5 +++--
sys/kern/sysv_msg.c | 2 +-
sys/kern/sysv_sem.c | 2 +-
sys/kern/sysv_shm.c | 2 +-
sys/sys/syscallsubr.h | 1 +
6 files changed, 14 insertions(+), 7 deletions(-)
diff --git a/sys/kern/kern_sig.c b/sys/kern/kern_sig.c
index a61ebfc5c7c8..5d51aa675cb7 100644
--- a/sys/kern/kern_sig.c
+++ b/sys/kern/kern_sig.c
@@ -1050,8 +1050,7 @@ osigaction(struct thread *td, struct osigaction_args *uap)
int
osigreturn(struct thread *td, struct osigreturn_args *uap)
{
-
- return (nosys(td, (struct nosys_args *)uap));
+ return (kern_nosys(td, 0));
}
#endif
#endif /* COMPAT_43 */
@@ -4287,6 +4286,12 @@ struct nosys_args {
/* ARGSUSED */
int
nosys(struct thread *td, struct nosys_args *args)
+{
+ return (kern_nosys(td, args->dummy));
+}
+
+int
+kern_nosys(struct thread *td, int dummy)
{
struct proc *p;
diff --git a/sys/kern/kern_syscalls.c b/sys/kern/kern_syscalls.c
index 24406763a93a..a93d711e7597 100644
--- a/sys/kern/kern_syscalls.c
+++ b/sys/kern/kern_syscalls.c
@@ -35,6 +35,7 @@
#include <sys/resourcevar.h>
#include <sys/sx.h>
#include <sys/syscall.h>
+#include <sys/syscallsubr.h>
#include <sys/sysent.h>
#include <sys/sysproto.h>
#include <sys/systm.h>
@@ -50,14 +51,14 @@ int
lkmnosys(struct thread *td, struct nosys_args *args)
{
- return (nosys(td, args));
+ return (kern_nosys(td, 0));
}
int
lkmressys(struct thread *td, struct nosys_args *args)
{
- return (nosys(td, args));
+ return (kern_nosys(td, 0));
}
struct sysent nosys_sysent = {
diff --git a/sys/kern/sysv_msg.c b/sys/kern/sysv_msg.c
index 11141d197aec..a545a0a54c25 100644
--- a/sys/kern/sysv_msg.c
+++ b/sys/kern/sysv_msg.c
@@ -1724,7 +1724,7 @@ freebsd32_msgsys(struct thread *td, struct freebsd32_msgsys_args *uap)
return (sys_msgsys(td, (struct msgsys_args *)uap));
}
#else
- return (nosys(td, NULL));
+ return (kern_nosys(td, 0));
#endif
}
diff --git a/sys/kern/sysv_sem.c b/sys/kern/sysv_sem.c
index e399517010fc..a99e1a4de14e 100644
--- a/sys/kern/sysv_sem.c
+++ b/sys/kern/sysv_sem.c
@@ -1904,7 +1904,7 @@ freebsd32_semsys(struct thread *td, struct freebsd32_semsys_args *uap)
return (sys_semsys(td, (struct semsys_args *)uap));
}
#else
- return (nosys(td, NULL));
+ return (kern_nosys(td, 0));
#endif
}
diff --git a/sys/kern/sysv_shm.c b/sys/kern/sysv_shm.c
index 60e3fe92a4b7..8d1a469127c6 100644
--- a/sys/kern/sysv_shm.c
+++ b/sys/kern/sysv_shm.c
@@ -1474,7 +1474,7 @@ freebsd32_shmsys(struct thread *td, struct freebsd32_shmsys_args *uap)
return (EINVAL);
}
#else
- return (nosys(td, NULL));
+ return (kern_nosys(td, 0));
#endif
}
diff --git a/sys/sys/syscallsubr.h b/sys/sys/syscallsubr.h
index fe6dd9e14fb4..fd183ffbc7a4 100644
--- a/sys/sys/syscallsubr.h
+++ b/sys/sys/syscallsubr.h
@@ -257,6 +257,7 @@ int kern_munlock(struct thread *td, uintptr_t addr, size_t size);
int kern_munmap(struct thread *td, uintptr_t addr, size_t size);
int kern_nanosleep(struct thread *td, struct timespec *rqt,
struct timespec *rmt);
+int kern_nosys(struct thread *td, int dummy);
int kern_ntp_adjtime(struct thread *td, struct timex *ntv, int *retvalp);
int kern_ogetdirentries(struct thread *td, struct ogetdirentries_args *uap,
long *ploff);