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:
Bahadir Balban
2009-05-26 17:02:32 +03:00
parent c25c81e95c
commit 93c7cf1995
2 changed files with 2 additions and 2 deletions

View File

@@ -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;

View File

@@ -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;
/*