diff options
author | dzwdz | 2022-09-02 14:44:52 +0200 |
---|---|---|
committer | dzwdz | 2022-09-02 17:58:47 +0200 |
commit | c16d956c0dd3d69748f7208e09bb69a6df8c6483 (patch) | |
tree | 38089f4b9e7fb153aa817e25340b7107f7cdf795 /src/kernel/proc.c | |
parent | 41a15bd16806261d66d55bbb85034553cd58361e (diff) |
kernel/proc: introduce child ids for telling children apart
Diffstat (limited to 'src/kernel/proc.c')
-rw-r--r-- | src/kernel/proc.c | 10 |
1 files changed, 8 insertions, 2 deletions
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; |