diff options
| author | Kimplul <kimi.h.kuparinen@gmail.com> | 2024-08-26 18:51:10 +0300 |
|---|---|---|
| committer | Kimplul <kimi.h.kuparinen@gmail.com> | 2024-08-26 18:51:10 +0300 |
| commit | b25156373cd89792b1c457b77699bb7f9beb430d (patch) | |
| tree | 56816903fcedc9fe35786b9baf43499d4ec3d19f /src/vmem.c | |
| parent | 260fc4c790ca25ee1ffab4edd9c6488d3bcb441c (diff) | |
| download | kmi-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 'src/vmem.c')
| -rw-r--r-- | src/vmem.c | 12 |
1 files changed, 6 insertions, 6 deletions
@@ -46,11 +46,11 @@ static stat_t __copy_mapped_region(struct tcb *d, struct tcb *s, if (ERR_CODE(v)) return v; + assert(v == start); + if (is_set(m->flags, MR_NONBACKED)) return v; - assert(v == start); - /* note that we use uvmem.vmem instead of proc.vmem, this is just to * make sure that zombies don't eat our brains */ stat_t res = copy_region(d->uvmem.vmem, s->uvmem.vmem, v, v, size); @@ -80,7 +80,7 @@ static stat_t __copy_shared_region(struct tcb *d, struct mem_region *m) vm_t start = m->start * BASE_PAGE_SIZE; vm_t end = m->end * BASE_PAGE_SIZE; - reference_proc(s); + reference_thread(s); size_t size = end - start; vm_t v = alloc_fixed_region(&d->uvmem.region, start, size, &size, @@ -115,7 +115,7 @@ static vm_t __clone_shared_region(struct tcb *d, struct tcb *s, vm_t start = m->start * BASE_PAGE_SIZE; vm_t end = m->end * BASE_PAGE_SIZE; - reference_proc(s); + reference_thread(s); size_t size = end - start; vm_t v = alloc_shared_region(&d->uvmem.region, size, &size, @@ -129,7 +129,7 @@ static vm_t __clone_shared_region(struct tcb *d, struct tcb *s, return v; /* cleanup on error */ - unreference_proc(s); + unreference_thread(s); free_region(&d->uvmem.region, v); unmap_fixed_region(d->uvmem.vmem, v, size); return res; @@ -145,7 +145,7 @@ static void __free_mapping(struct tcb *t, struct mem_region *m) { struct tcb *owner = get_tcb(m->pid); if (owner) - unreference_proc(owner); + unreference_thread(owner); if (is_set(m->flags, MR_NONBACKED)) return; |
