From b25156373cd89792b1c457b77699bb7f9beb430d Mon Sep 17 00:00:00 2001 From: Kimplul Date: Mon, 26 Aug 2024 18:51:10 +0300 Subject: 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. --- src/uapi/ipc.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'src/uapi/ipc.c') diff --git a/src/uapi/ipc.c b/src/uapi/ipc.c index 850178c..0fba899 100644 --- a/src/uapi/ipc.c +++ b/src/uapi/ipc.c @@ -71,7 +71,7 @@ static inline void finalize_rpc(struct tcb *t, struct tcb *r, vm_t s) { clone_uvmem(r->proc.vmem, t->rpc.vmem); set_return(t, r->callback); - reference_proc(r); + reference_thread(r); t->pid = r->rid; /* make sure updates are visible when swapping to the new virtual memory */ @@ -446,6 +446,7 @@ SYSCALL_DEFINE4(ipc_resp)(struct tcb *t, sys_arg_t d0, sys_arg_t d1, /* inform requester who answered (pid) in the case of the request being * kicked forward */ enable_irqs(); + unreference_thread(get_cproc(t)); leave_rpc(t, SYS_RET6(OK, t->pid, d0, d1, d2, d3)); } -- cgit v1.3