aboutsummaryrefslogtreecommitdiffstats
path: root/include/linux/ptrace.h
diff options
context:
space:
mode:
authorRoland McGrath <roland@redhat.com>2008-07-25 22:45:47 -0400
committerLinus Torvalds <torvalds@linux-foundation.org>2008-07-26 15:00:08 -0400
commit09a05394fe2448a4139b014936330af23fa7ec83 (patch)
treea7b3f0ffe271d4d35c3b98a99183d8792ea4db53 /include/linux/ptrace.h
parent30199f5a46aee204bf437a4f5b0740f3efe448b7 (diff)
tracehook: clone
This moves all the ptrace initialization and tracing logic for task creation into tracehook.h and ptrace.h inlines. It reorganizes the code slightly, but should not change any behavior. There are four tracehook entry points, at each important stage of task creation. This keeps the interface from the core fork.c code fairly clean, while supporting the complex setup required for ptrace or something like it. Signed-off-by: Roland McGrath <roland@redhat.com> Cc: Oleg Nesterov <oleg@tv-sign.ru> Reviewed-by: Ingo Molnar <mingo@elte.hu> Signed-off-by: Andrew Morton <akpm@linux-foundation.org> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Diffstat (limited to 'include/linux/ptrace.h')
-rw-r--r--include/linux/ptrace.h22
1 files changed, 22 insertions, 0 deletions
diff --git a/include/linux/ptrace.h b/include/linux/ptrace.h
index c74abfc4c7e8..dae6d85520fb 100644
--- a/include/linux/ptrace.h
+++ b/include/linux/ptrace.h
@@ -154,6 +154,28 @@ static inline int ptrace_event(int mask, int event, unsigned long message)
154 return 1; 154 return 1;
155} 155}
156 156
157/**
158 * ptrace_init_task - initialize ptrace state for a new child
159 * @child: new child task
160 * @ptrace: true if child should be ptrace'd by parent's tracer
161 *
162 * This is called immediately after adding @child to its parent's children
163 * list. @ptrace is false in the normal case, and true to ptrace @child.
164 *
165 * Called with current's siglock and write_lock_irq(&tasklist_lock) held.
166 */
167static inline void ptrace_init_task(struct task_struct *child, bool ptrace)
168{
169 INIT_LIST_HEAD(&child->ptrace_entry);
170 INIT_LIST_HEAD(&child->ptraced);
171 child->parent = child->real_parent;
172 child->ptrace = 0;
173 if (unlikely(ptrace)) {
174 child->ptrace = current->ptrace;
175 __ptrace_link(child, current->parent);
176 }
177}
178
157#ifndef force_successful_syscall_return 179#ifndef force_successful_syscall_return
158/* 180/*
159 * System call handlers that, upon successful completion, need to return a 181 * System call handlers that, upon successful completion, need to return a