diff options
author | dzwdz | 2022-05-04 13:49:38 +0200 |
---|---|---|
committer | dzwdz | 2022-05-04 13:49:38 +0200 |
commit | 3bf07641ee5ba1c6ec56b81a7f34abe1267d3ac1 (patch) | |
tree | 2eee4442a5aba9fe3a29078a2e8187d999af83a3 /src/kernel/proc.c | |
parent | 9692ed2f93777e1060837b97687509f8a22c2b60 (diff) |
kernel: refcount vfs_backend
what a mess
Diffstat (limited to 'src/kernel/proc.c')
-rw-r--r-- | src/kernel/proc.c | 12 |
1 files changed, 11 insertions, 1 deletions
diff --git a/src/kernel/proc.c b/src/kernel/proc.c index 90570b8..40399d8 100644 --- a/src/kernel/proc.c +++ b/src/kernel/proc.c @@ -63,8 +63,10 @@ struct process *process_fork(struct process *parent, int flags) { parent->handled_req = NULL; // TODO control this with a flag - if (child->controlled) + if (child->controlled) { child->controlled->potential_handlers++; + child->controlled->refcount++; + } for (handle_t h = 0; h < HANDLE_MAX; h++) { if (child->handles[h]) @@ -111,6 +113,11 @@ void process_free(struct process *p) { vfs_mount_remref(p->mount); p->mount = NULL; + if (p->controlled) { + vfs_backend_refdown(p->controlled); + p->controlled = NULL; + } + if (!p->parent) return; process_forget(p); pagedir_free(p->pages); // TODO could be done on kill @@ -273,11 +280,14 @@ void process_kill(struct process *p, int ret) { vfs_request_cancel(q, ret); q = q2; } + p->controlled->queue = NULL; } if (p->controlled->handler == p) { assert(p->state == PS_WAITS4REQUEST); p->controlled->handler = NULL; } + + vfs_backend_refdown(p->controlled); p->controlled = NULL; } |