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/orphanage.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) (limited to 'src/orphanage.c') diff --git a/src/orphanage.c b/src/orphanage.c index 526affc..797468d 100644 --- a/src/orphanage.c +++ b/src/orphanage.c @@ -29,16 +29,16 @@ void unorphanize(struct tcb *t) /* attach to init process */ struct tcb *init = get_tcb(1); - reference_proc(init); + reference_thread(init); + + free_stack(t); + reset_rpc_stack(t); id_t old_rid = t->rid; t->rid = 1; t->pid = 1; t->eid = 1; - free_stack(t); - reset_rpc_stack(t); - t->proc = init->proc; use_vmem(t->proc.vmem); alloc_stack(t); -- cgit v1.3