From 954389acc4fdda1b6dbd3e9c3cf6d5767af40a84 Mon Sep 17 00:00:00 2001 From: Ian Moffett Date: Sat, 20 Sep 2025 20:51:50 -0400 Subject: kern: proc: Move sys_exit() to sys/compat/unix/* Signed-off-by: Ian Moffett --- src/sys/compat/unix/os/proc_syscall.c | 50 ++++++++++++++++++++++++++++++++++ src/sys/include/compat/unix/syscall.h | 5 ++++ src/sys/include/sys/proc.h | 5 ---- src/sys/os/Makefile | 1 + src/sys/os/proc_syscall.c | 51 ----------------------------------- 5 files changed, 56 insertions(+), 56 deletions(-) create mode 100644 src/sys/compat/unix/os/proc_syscall.c delete mode 100644 src/sys/os/proc_syscall.c (limited to 'src/sys') diff --git a/src/sys/compat/unix/os/proc_syscall.c b/src/sys/compat/unix/os/proc_syscall.c new file mode 100644 index 0000000..1838761 --- /dev/null +++ b/src/sys/compat/unix/os/proc_syscall.c @@ -0,0 +1,50 @@ +/* + * Copyright (c) 2025 Ian Marco Moffett and L5 engineers + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are met: + * + * 1. Redistributions of source code must retain the above copyright notice, + * this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * 3. Neither the name of the project nor the names of its + * contributors may be used to endorse or promote products derived from + * this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" + * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE + * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR + * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF + * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS + * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN + * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) + * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE + * POSSIBILITY OF SUCH DAMAGE. + */ + +#include +#include +#include +#include +#include +#include +#include + +/* + * ARG 0: Status + */ +__dead scret_t +sys_exit(struct syscall_args *scargs) +{ + struct pcore *core = this_core(); + int status; + + status = SCARG(scargs, int, 0); + proc_kill(core->curproc, status); + md_proc_yield(); /* unreachable */ +} diff --git a/src/sys/include/compat/unix/syscall.h b/src/sys/include/compat/unix/syscall.h index 8d0af91..2bb699a 100644 --- a/src/sys/include/compat/unix/syscall.h +++ b/src/sys/include/compat/unix/syscall.h @@ -34,6 +34,11 @@ #include #include +/* + * Exit the current process - exit(2) syscall + */ +scret_t sys_exit(struct syscall_args *scargs); + #ifdef _NEED_UNIX_SCTAB scret_t(*g_unix_sctab[])(struct syscall_args *) = { [SYS_none] = NULL, diff --git a/src/sys/include/sys/proc.h b/src/sys/include/sys/proc.h index cf00850..2ff2876 100644 --- a/src/sys/include/sys/proc.h +++ b/src/sys/include/sys/proc.h @@ -159,10 +159,5 @@ __dead void md_proc_yield(void); */ __dead void md_proc_kick(struct proc *procp); -/* - * Exit the current process - exit(2) syscall - */ -scret_t sys_exit(struct syscall_args *scargs); - #endif /* !_KERNEL */ #endif /* !_SYS_PROC_H_ */ diff --git a/src/sys/os/Makefile b/src/sys/os/Makefile index ed8ac6e..de73afd 100644 --- a/src/sys/os/Makefile +++ b/src/sys/os/Makefile @@ -11,6 +11,7 @@ CFILES += $(shell find ../vm -name "*.c") CFILES += $(shell find ../lib -name "*.c") CFILES += $(shell find ../io -name "*.c") CFILES += $(shell find ../acpi -name "*.c") +CFILES += $(shell find ../compat -name "*.c") DEPS = $(CFILES:.c=.d) OBJECTS = $(CFILES:%.c=%.o) diff --git a/src/sys/os/proc_syscall.c b/src/sys/os/proc_syscall.c deleted file mode 100644 index e71d546..0000000 --- a/src/sys/os/proc_syscall.c +++ /dev/null @@ -1,51 +0,0 @@ -/* - * Copyright (c) 2025 Ian Marco Moffett and L5 engineers - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions are met: - * - * 1. Redistributions of source code must retain the above copyright notice, - * this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * 3. Neither the name of the project nor the names of its - * contributors may be used to endorse or promote products derived from - * this software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" - * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE - * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR - * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF - * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS - * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN - * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) - * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE - * POSSIBILITY OF SUCH DAMAGE. - */ - -#include -#include -#include -#include -#include -#include - -#include - -/* - * ARG 0: Status - */ -__dead scret_t -sys_exit(struct syscall_args *scargs) -{ - struct pcore *core = this_core(); - int status; - - status = SCARG(scargs, int, 0); - proc_kill(core->curproc, status); - md_proc_yield(); /* unreachable */ -} -- cgit v1.2.3