struct process: fix type of group_exit_status
Change-Id: Ib8492cbb077106cef1d0fa2d6d5e8e13bbb209c0 Refs: #1377
This commit is contained in:
committed by
Masamichi Takagi
parent
56b51d4f97
commit
58106d791a
@@ -505,10 +505,12 @@ struct process {
|
||||
// PS_STOPPED -----+
|
||||
// (PS_TRACED)
|
||||
|
||||
/* Store exit_status for a group of threads when stopped by SIGSTOP.
|
||||
exit_status can't be used because values of exit_status of threads
|
||||
might divert while the threads are exiting by group_exit(). */
|
||||
int group_exit_status;
|
||||
/* Store exit_status for a group of threads when stopped by SIGSTOP. */
|
||||
/* exit_status can't be used because values of exit_status of threads */
|
||||
/* might divert while the threads are exiting by group_exit(). */
|
||||
/* The upper 4 bytes of group_exit_status is the confirmation flag of */
|
||||
/* exit status. The lower 4 bytes is the exit status. */
|
||||
unsigned long group_exit_status;
|
||||
|
||||
/* Manage ptraced processes in the separate list to make it easy to
|
||||
restore the orginal parent child relationship when
|
||||
|
||||
@@ -448,34 +448,59 @@ static int wait_stopped(struct thread *thread, struct process *child, struct thr
|
||||
thread->proc->pid, child->pid, options);
|
||||
int ret;
|
||||
|
||||
/* Copy exit_status created in do_signal */
|
||||
int *exit_status;
|
||||
|
||||
if (c_thread) {
|
||||
exit_status = &c_thread->exit_status;
|
||||
/* Skip this process because exit_status has been reaped. */
|
||||
if (!c_thread->exit_status) {
|
||||
ret = 0;
|
||||
goto out;
|
||||
}
|
||||
|
||||
/* TODO: define 0x7f in kernel/include/process.h */
|
||||
if (status) {
|
||||
*status = (c_thread->exit_status << 8) | 0x7f;
|
||||
}
|
||||
|
||||
/* Reap exit_status. signal_flags is reaped on receiving */
|
||||
/* signal in do_kill(). */
|
||||
if (!(options & WNOWAIT)) {
|
||||
c_thread->exit_status = 0;
|
||||
}
|
||||
}
|
||||
else if (child->status & (PS_STOPPED | PS_DELAY_STOPPED)) {
|
||||
exit_status = &child->group_exit_status;
|
||||
/* Skip this process because exit_status has been reaped. */
|
||||
if (!child->group_exit_status) {
|
||||
ret = 0;
|
||||
goto out;
|
||||
}
|
||||
|
||||
/* TODO: define 0x7f in kernel/include/process.h */
|
||||
if (status) {
|
||||
*status = (child->group_exit_status << 8) | 0x7f;
|
||||
}
|
||||
|
||||
/* Reap exit_status. signal_flags is reaped on receiving */
|
||||
/* signal in do_kill(). */
|
||||
if (!(options & WNOWAIT)) {
|
||||
child->group_exit_status = 0;
|
||||
}
|
||||
}
|
||||
else {
|
||||
exit_status = &child->main_thread->exit_status;
|
||||
}
|
||||
/* Skip this process because exit_status has been reaped. */
|
||||
if (!child->main_thread->exit_status) {
|
||||
ret = 0;
|
||||
goto out;
|
||||
}
|
||||
|
||||
/* Skip this process because exit_status has been reaped. */
|
||||
if (!*exit_status) {
|
||||
ret = 0;
|
||||
goto out;
|
||||
}
|
||||
/* TODO: define 0x7f in kernel/include/process.h */
|
||||
if (status) {
|
||||
*status = (child->main_thread->exit_status << 8) | 0x7f;
|
||||
}
|
||||
|
||||
/* TODO: define 0x7f in kernel/include/process.h */
|
||||
if (status) {
|
||||
*status = (*exit_status << 8) | 0x7f;
|
||||
}
|
||||
|
||||
/* Reap exit_status. signal_flags is reaped on receiving signal
|
||||
in do_kill(). */
|
||||
if(!(options & WNOWAIT)) {
|
||||
*exit_status = 0;
|
||||
/* Reap exit_status. signal_flags is reaped on receiving */
|
||||
/* signal in do_kill(). */
|
||||
if (!(options & WNOWAIT)) {
|
||||
child->main_thread->exit_status = 0;
|
||||
}
|
||||
}
|
||||
|
||||
dkprintf("wait_stopped,child->pid=%d,status=%08x\n",
|
||||
|
||||
Reference in New Issue
Block a user