[PATCH 5/5] Use wait_copyout() in wait_task_continued()

From: Vitaly Mayatskikh
Date: Mon May 11 2009 - 06:14:38 EST


All copy-paste getrusage() and put_user() code in wait_task_* functions
is replaced by call to wait_copyout()

It makes no sense to do conditional siginfo's fill, wait_copyout() knows
how to handle it right.

Signed-off-by: Vitaly Mayatskikh <v.mayatskih@xxxxxxxxx>
---
kernel/exit.c | 23 ++++++++++-------------
1 files changed, 10 insertions(+), 13 deletions(-)

diff --git a/kernel/exit.c b/kernel/exit.c
index 1ff490d..690a1a6 100644
--- a/kernel/exit.c
+++ b/kernel/exit.c
@@ -1416,19 +1416,16 @@ static int wait_task_continued(struct wait_opts *wo, struct task_struct *p)
get_task_struct(p);
read_unlock(&tasklist_lock);

- if (!wo->wo_info) {
- retval = wo->wo_rusage
- ? getrusage(p, RUSAGE_BOTH, wo->wo_rusage) : 0;
- put_task_struct(p);
- if (!retval && wo->wo_stat)
- retval = put_user(0xffff, wo->wo_stat);
- if (!retval)
- retval = pid;
- } else {
- retval = wait_noreap_copyout(wo, p, pid, uid,
- CLD_CONTINUED, SIGCONT);
- BUG_ON(retval == 0);
- }
+ retval = wait_copyout(wo, p, pid, uid,
+ CLD_CONTINUED, SIGCONT, SIGCHLD);
+ put_task_struct(p);
+
+ if (!retval && wo->wo_stat)
+ retval = put_user(0xffff, wo->wo_stat);
+ if (!retval)
+ retval = pid;
+
+ BUG_ON(retval == 0);

return retval;
}
--
1.6.2.2

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/