Commit 074127b5 authored by Andrew Morton's avatar Andrew Morton Committed by Linus Torvalds

[PATCH] CLONE_STOPPED

From: Ulrich Drepper <drepper@redhat.com>

CLONE_STOPPED: start a thread in a stopped state.  Required for NTPL.
parent 7b17636c
...@@ -52,6 +52,7 @@ struct exec_domain; ...@@ -52,6 +52,7 @@ struct exec_domain;
#define CLONE_DETACHED 0x00400000 /* parent wants no child-exit signal */ #define CLONE_DETACHED 0x00400000 /* parent wants no child-exit signal */
#define CLONE_UNTRACED 0x00800000 /* set if the tracing process can't force CLONE_PTRACE on this clone */ #define CLONE_UNTRACED 0x00800000 /* set if the tracing process can't force CLONE_PTRACE on this clone */
#define CLONE_CHILD_SETTID 0x01000000 /* set the TID in the child */ #define CLONE_CHILD_SETTID 0x01000000 /* set the TID in the child */
#define CLONE_STOPPED 0x02000000 /* Start in stopped state */
/* /*
* List of flags we want to share for kernel threads, * List of flags we want to share for kernel threads,
......
...@@ -1076,7 +1076,7 @@ long do_fork(unsigned long clone_flags, ...@@ -1076,7 +1076,7 @@ long do_fork(unsigned long clone_flags,
init_completion(&vfork); init_completion(&vfork);
} }
if (p->ptrace & PT_PTRACED) { if ((p->ptrace & PT_PTRACED) || (clone_flags & CLONE_STOPPED)) {
/* /*
* We'll start up with an immediate SIGSTOP. * We'll start up with an immediate SIGSTOP.
*/ */
...@@ -1084,6 +1084,8 @@ long do_fork(unsigned long clone_flags, ...@@ -1084,6 +1084,8 @@ long do_fork(unsigned long clone_flags,
set_tsk_thread_flag(p, TIF_SIGPENDING); set_tsk_thread_flag(p, TIF_SIGPENDING);
} }
p->state = TASK_STOPPED;
if (!(clone_flags & CLONE_STOPPED))
wake_up_forked_process(p); /* do this last */ wake_up_forked_process(p); /* do this last */
++total_forks; ++total_forks;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment