fix process refcount so that process structure is still valid when final release() is called in schedule()
This commit is contained in:
@@ -130,7 +130,7 @@ struct process *create_process(unsigned long user_pc)
|
|||||||
return NULL;
|
return NULL;
|
||||||
|
|
||||||
memset(proc, 0, sizeof(struct process));
|
memset(proc, 0, sizeof(struct process));
|
||||||
ihk_atomic_set(&proc->refcount, 1);
|
ihk_atomic_set(&proc->refcount, 2);
|
||||||
|
|
||||||
proc->sighandler = kmalloc(sizeof(struct sig_handler), IHK_MC_AP_NOWAIT);
|
proc->sighandler = kmalloc(sizeof(struct sig_handler), IHK_MC_AP_NOWAIT);
|
||||||
if(!proc->sighandler){
|
if(!proc->sighandler){
|
||||||
@@ -194,7 +194,7 @@ struct process *clone_process(struct process *org, unsigned long pc,
|
|||||||
}
|
}
|
||||||
|
|
||||||
memset(proc, 0, sizeof(struct process));
|
memset(proc, 0, sizeof(struct process));
|
||||||
ihk_atomic_set(&proc->refcount, 1);
|
ihk_atomic_set(&proc->refcount, 2);
|
||||||
|
|
||||||
/* NOTE: sp is the user mode stack! */
|
/* NOTE: sp is the user mode stack! */
|
||||||
ihk_mc_init_user_process(&proc->ctx, &proc->uctx,
|
ihk_mc_init_user_process(&proc->ctx, &proc->uctx,
|
||||||
|
|||||||
@@ -404,7 +404,10 @@ terminate(int rc, int sig, ihk_mc_user_context_t *ctx)
|
|||||||
}
|
}
|
||||||
|
|
||||||
release_fork_tree_node(ftn);
|
release_fork_tree_node(ftn);
|
||||||
|
|
||||||
|
proc->status = PS_EXITED;
|
||||||
release_process(proc);
|
release_process(proc);
|
||||||
|
|
||||||
schedule();
|
schedule();
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -1743,6 +1746,7 @@ SYSCALL_DECLARE(exit)
|
|||||||
|
|
||||||
proc->status = PS_ZOMBIE;
|
proc->status = PS_ZOMBIE;
|
||||||
|
|
||||||
|
release_fork_tree_node(proc->ftn);
|
||||||
release_process(proc);
|
release_process(proc);
|
||||||
|
|
||||||
schedule();
|
schedule();
|
||||||
|
|||||||
Reference in New Issue
Block a user