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

Vitaly Mayatskikh
2009-05-11T13:28:51Z

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

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

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

diff --git a/kernel/exit.c b/kernel/exit.c
index 9806332..f22e82c 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 = copy_wait_opts_to_user(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