mirror of
https://github.com/drasko/codezero.git
synced 2026-01-12 02:43:15 +01:00
Fixed fork() errors where forked thread is a copy of any cloned thread in parent address space.
Upon fork, child was created in a new space but as a copy of any cloned thread in the parent space. This was due to the search of forker thread by its space id (which is shared among many cloned threads). Now fixed. modified: src/api/thread.c modified: tasks/mm0/src/task.c
This commit is contained in:
@@ -309,7 +309,7 @@ int thread_create(struct task_ids *ids, unsigned int flags)
|
||||
return -ENOMEM;
|
||||
|
||||
if (flags == THREAD_SAME_SPACE || flags == THREAD_COPY_SPACE) {
|
||||
if (!(orig_task = tcb_find_by_space(ids->spid))) {
|
||||
if (!(orig_task = tcb_find(ids->tid))) {
|
||||
/* Pre-mature tcb needs freeing by free_page */
|
||||
free_page(new);
|
||||
return -EINVAL;
|
||||
|
||||
@@ -308,7 +308,7 @@ struct tcb *task_create(struct tcb *parent, struct task_ids *ids,
|
||||
|
||||
/* Set task ids if a parent is supplied */
|
||||
if (parent) {
|
||||
ids->tid = TASK_ID_INVALID;
|
||||
ids->tid = parent->tid;
|
||||
ids->spid = parent->spid;
|
||||
|
||||
/*
|
||||
|
||||
Reference in New Issue
Block a user