summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAndrew Morton <akpm@osdl.org>2003-07-17 19:27:39 -0700
committerLinus Torvalds <torvalds@home.osdl.org>2003-07-17 19:27:39 -0700
commit074127b5eb6578e95561061de60f7ecaaa592694 (patch)
treed219051625594ca777807134b58820a6c4693492
parent7b17636cb9eb6d54b8812ac2a9859ed1f9e6ca48 (diff)
[PATCH] CLONE_STOPPED
From: Ulrich Drepper <drepper@redhat.com> CLONE_STOPPED: start a thread in a stopped state. Required for NTPL.
-rw-r--r--include/linux/sched.h1
-rw-r--r--kernel/fork.c6
2 files changed, 5 insertions, 2 deletions
diff --git a/include/linux/sched.h b/include/linux/sched.h
index 750f2a12cada..bf740af246c0 100644
--- a/include/linux/sched.h
+++ b/include/linux/sched.h
@@ -52,6 +52,7 @@ struct exec_domain;
#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_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,
diff --git a/kernel/fork.c b/kernel/fork.c
index 24cba7f5f25d..7c4c94b1a968 100644
--- a/kernel/fork.c
+++ b/kernel/fork.c
@@ -1076,7 +1076,7 @@ long do_fork(unsigned long clone_flags,
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.
*/
@@ -1084,7 +1084,9 @@ long do_fork(unsigned long clone_flags,
set_tsk_thread_flag(p, TIF_SIGPENDING);
}
- wake_up_forked_process(p); /* do this last */
+ p->state = TASK_STOPPED;
+ if (!(clone_flags & CLONE_STOPPED))
+ wake_up_forked_process(p); /* do this last */
++total_forks;
if (unlikely (trace)) {