Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 139679
b: refs/heads/master
c: 90bc8d8
h: refs/heads/master
i:
  139677: a0d66c6
  139675: 3c87c74
  139671: 369ba4b
  139663: 10a3ceb
  139647: 138eab6
v: v3
  • Loading branch information
Oleg Nesterov authored and Linus Torvalds committed Apr 3, 2009
1 parent cc04916 commit f03449f
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 13 deletions.
2 changes: 1 addition & 1 deletion [refs]
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
refs/heads/master: 6d7b2f5f9e88902b19f91d0c8a7ef58a5455f1a2
refs/heads/master: 90bc8d8b1a38f1ab131a2399a202e1889db95de8
30 changes: 18 additions & 12 deletions trunk/kernel/exit.c
Original file line number Diff line number Diff line change
Expand Up @@ -1417,6 +1417,18 @@ static int wait_task_zombie(struct task_struct *p, int options,
return retval;
}

static int *task_stopped_code(struct task_struct *p, bool ptrace)
{
if (ptrace) {
if (task_is_stopped_or_traced(p))
return &p->exit_code;
} else {
if (p->signal->flags & SIGNAL_STOP_STOPPED)
return &p->signal->group_exit_code;
}
return NULL;
}

/*
* Handle sys_wait4 work for one task in state TASK_STOPPED. We hold
* read_lock(&tasklist_lock) on entry. If we return zero, we still hold
Expand All @@ -1427,7 +1439,7 @@ static int wait_task_stopped(int ptrace, struct task_struct *p,
int options, struct siginfo __user *infop,
int __user *stat_addr, struct rusage __user *ru)
{
int retval, exit_code, why;
int retval, exit_code, *p_code, why;
uid_t uid = 0; /* unneeded, required by compiler */
pid_t pid;

Expand All @@ -1437,22 +1449,16 @@ static int wait_task_stopped(int ptrace, struct task_struct *p,
exit_code = 0;
spin_lock_irq(&p->sighand->siglock);

if (unlikely(!task_is_stopped_or_traced(p)))
goto unlock_sig;

if (!ptrace && p->signal->group_stop_count > 0)
/*
* A group stop is in progress and this is the group leader.
* We won't report until all threads have stopped.
*/
p_code = task_stopped_code(p, ptrace);
if (unlikely(!p_code))
goto unlock_sig;

exit_code = p->exit_code;
exit_code = *p_code;
if (!exit_code)
goto unlock_sig;

if (!unlikely(options & WNOWAIT))
p->exit_code = 0;
*p_code = 0;

/* don't need the RCU readlock here as we're holding a spinlock */
uid = __task_cred(p)->uid;
Expand Down Expand Up @@ -1608,7 +1614,7 @@ static int wait_consider_task(struct task_struct *parent, int ptrace,
*/
*notask_error = 0;

if (task_is_stopped_or_traced(p))
if (task_stopped_code(p, ptrace))
return wait_task_stopped(ptrace, p, options,
infop, stat_addr, ru);

Expand Down

0 comments on commit f03449f

Please sign in to comment.