lkml.org 
[lkml]   [2011]   [Jul]   [27]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
Patch in this message
/
Date
From
Subject[PATCH 2/8] vfork: introduce clone_vfork_finish()
No functional changes.

Move the wait-for-vfork_done code from do_wait() into the new
helper, clone_vfork_finish().

Signed-off-by: Oleg Nesterov <oleg@redhat.com>
---

kernel/fork.c | 19 +++++++++++++------
1 file changed, 13 insertions(+), 6 deletions(-)

--- 3.1/kernel/fork.c~2_wait_for_vfork_done 2011-07-26 17:52:25.000000000 +0200
+++ 3.1/kernel/fork.c 2011-07-26 17:52:59.000000000 +0200
@@ -1449,6 +1449,17 @@ void complete_vfork_done(struct task_str
complete(vfork_done);
}

+static long clone_vfork_finish(struct task_struct *child,
+ struct completion *vfork_done, long pid)
+{
+ freezer_do_not_count();
+ wait_for_completion(vfork_done);
+ freezer_count();
+
+ ptrace_event(PTRACE_EVENT_VFORK_DONE, pid);
+ return pid;
+}
+
/*
* Ok, this is the main fork-routine.
*
@@ -1536,12 +1547,8 @@ long do_fork(unsigned long clone_flags,
if (unlikely(trace))
ptrace_event(trace, nr);

- if (clone_flags & CLONE_VFORK) {
- freezer_do_not_count();
- wait_for_completion(&vfork);
- freezer_count();
- ptrace_event(PTRACE_EVENT_VFORK_DONE, nr);
- }
+ if (clone_flags & CLONE_VFORK)
+ nr = clone_vfork_finish(p, &vfork, nr);
} else {
nr = PTR_ERR(p);
}


\
 
 \ /
  Last update: 2011-07-27 18:37    [W:0.229 / U:0.144 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site