aboutsummaryrefslogtreecommitdiff
path: root/include
diff options
context:
space:
mode:
authorKimplul <kimi.h.kuparinen@gmail.com>2024-08-26 18:51:10 +0300
committerKimplul <kimi.h.kuparinen@gmail.com>2024-08-26 18:51:10 +0300
commitb25156373cd89792b1c457b77699bb7f9beb430d (patch)
tree56816903fcedc9fe35786b9baf43499d4ec3d19f /include
parent260fc4c790ca25ee1ffab4edd9c6488d3bcb441c (diff)
downloadkmi-b25156373cd89792b1c457b77699bb7f9beb430d.tar.gz
kmi-b25156373cd89792b1c457b77699bb7f9beb430d.zip
improve killing processes/threads, test
+ Remove sys_kill() as we should be using a two-stage process where a thread is first orphaned by sys_detach(), and then the thread itself calls sys_exit() after it has done all necessary cleanup in init.
Diffstat (limited to 'include')
-rw-r--r--include/kmi/syscalls.h3
-rw-r--r--include/kmi/tcb.h15
-rw-r--r--include/kmi/uapi.h13
3 files changed, 8 insertions, 23 deletions
diff --git a/include/kmi/syscalls.h b/include/kmi/syscalls.h
index 28e7505..a4d2c52 100644
--- a/include/kmi/syscalls.h
+++ b/include/kmi/syscalls.h
@@ -120,9 +120,6 @@ enum sys_code {
/** Execute new binary in new process space. */
SYS_SPAWN,
- /** Kill thread. */
- SYS_KILL,
-
/** Switch running process. */
SYS_SWAP,
diff --git a/include/kmi/tcb.h b/include/kmi/tcb.h
index 6cc63b5..d61845f 100644
--- a/include/kmi/tcb.h
+++ b/include/kmi/tcb.h
@@ -354,27 +354,28 @@ bool running(struct tcb *t);
bool zombie(struct tcb *t);
/**
- * Add a reference to a process.
+ * Add a reference to a thread.
* Instead of lists of threads that belong to a process, we give the process'
* owning thread a reference counter. When a process is killed, a 'dead' bit is
* set, and the thread that owns the process is unreferenced. All data
* associated with the process can immediately be freed, but the tid is still
- * reserved until the reference count reaches zero.
+ * reserved until the reference count reaches zero. In this sense, a process is
+ * seen as some memory that some thread happens to own.
*
* We have to make sure that all ways a process might be entered check that the
* process is still alive, and unmapping pages causes other threads to update
* their page tables as well. Then if a segfault happens, we can check if it was
* due to being in a dead process. This is still largely TODO.
*
- * @param p Process to reference.
+ * @param t Thread to reference.
*/
-void reference_proc(struct tcb *p);
+void reference_thread(struct tcb *t);
/**
- * Unreference a process.
+ * Unreference a thread.
*
- * @param p Process to unreference.
+ * @param t Thread to unreference.
*/
-void unreference_proc(struct tcb *p);
+void unreference_thread(struct tcb *t);
#endif /* KMI_TCB_H */
diff --git a/include/kmi/uapi.h b/include/kmi/uapi.h
index 6e5f865..b0740a9 100644
--- a/include/kmi/uapi.h
+++ b/include/kmi/uapi.h
@@ -656,19 +656,6 @@ SYSCALL_DECLARE2(exec, bin, interp);
SYSCALL_DECLARE2(spawn, bin, interp);
/**
- * Kill syscall. Requests that all memory in process \p pid is freed and all
- * threads are orphaned. If \p pid is not a process, nothing is done.
- *
- * @param t Current tcb.
- * @param pid Thread ID to kill. 0 if self.
- * @param b Unused.
- * @param c Unused.
- * @param d Unused.
- * @param e Unused.
- */
-SYSCALL_DECLARE1(kill, pid);
-
-/**
* Swap syscall.
*
* Swap currently running thread.