From c16d956c0dd3d69748f7208e09bb69a6df8c6483 Mon Sep 17 00:00:00 2001 From: dzwdz Date: Fri, 2 Sep 2022 14:44:52 +0200 Subject: kernel/proc: introduce child ids for telling children apart --- src/kernel/proc.c | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) (limited to 'src/kernel/proc.c') diff --git a/src/kernel/proc.c b/src/kernel/proc.c index 71d1f44..85992d5 100644 --- a/src/kernel/proc.c +++ b/src/kernel/proc.c @@ -26,7 +26,9 @@ struct process *process_seed(void *data, size_t datalen) { process_first->state = PS_RUNNING; process_first->pages = pagedir_new(); process_first->mount = vfs_mount_seed(); - process_first->id = next_pid++; + process_first->globalid = next_pid++; + process_first->cid = 1; + process_first->nextcid = 1; process_first->_handles = kzalloc(sizeof(struct handle) * HANDLE_MAX); // map .shared @@ -68,7 +70,11 @@ struct process *process_fork(struct process *parent, int flags) { child->parent = parent; parent->child = child; - child->id = next_pid++; + if (parent->nextcid == 0) + panic_unimplemented(); + child->cid = parent->nextcid++; + child->nextcid = 1; + child->globalid = next_pid++; if ((flags & FORK_NEWFS) == 0 && parent->controlled) { child->controlled = parent->controlled; -- cgit v1.2.3