aboutsummaryrefslogtreecommitdiffstats
path: root/arch/cris/arch-v10
diff options
context:
space:
mode:
authorChristoph Hellwig <hch@lst.de>2005-11-07 03:59:47 -0500
committerLinus Torvalds <torvalds@g5.osdl.org>2005-11-07 10:53:42 -0500
commit481bed454247538e9f57d4ea37b153ccba24ba7b (patch)
treebb4198296962c08dbf52e8f377dc27206f621640 /arch/cris/arch-v10
parentdb73e9aa99bf093427b79877f9475392724fd5e5 (diff)
[PATCH] consolidate sys_ptrace()
The sys_ptrace boilerplate code (everything outside the big switch statement for the arch-specific requests) is shared by most architectures. This patch moves it to kernel/ptrace.c and leaves the arch-specific code as arch_ptrace. Some architectures have a too different ptrace so we have to exclude them. They continue to keep their implementations. For sh64 I had to add a sh64_ptrace wrapper because it does some initialization on the first call. For um I removed an ifdefed SUBARCH_PTRACE_SPECIAL block, but SUBARCH_PTRACE_SPECIAL isn't defined anywhere in the tree. Signed-off-by: Christoph Hellwig <hch@lst.de> Acked-by: Paul Mackerras <paulus@samba.org> Acked-by: Ralf Baechle <ralf@linux-mips.org> Acked-By: David Howells <dhowells@redhat.com> Acked-by: Russell King <rmk+kernel@arm.linux.org.uk> Acked-by: Paul Mundt <lethal@linux-sh.org> Signed-off-by: Andrew Morton <akpm@osdl.org> Signed-off-by: Linus Torvalds <torvalds@osdl.org>
Diffstat (limited to 'arch/cris/arch-v10')
-rw-r--r--arch/cris/arch-v10/kernel/ptrace.c51
1 files changed, 2 insertions, 49 deletions
diff --git a/arch/cris/arch-v10/kernel/ptrace.c b/arch/cris/arch-v10/kernel/ptrace.c
index 130dd214e41d..6cbd34a27b90 100644
--- a/arch/cris/arch-v10/kernel/ptrace.c
+++ b/arch/cris/arch-v10/kernel/ptrace.c
@@ -76,55 +76,11 @@ ptrace_disable(struct task_struct *child)
76 * (in user space) where the result of the ptrace call is written (instead of 76 * (in user space) where the result of the ptrace call is written (instead of
77 * being returned). 77 * being returned).
78 */ 78 */
79asmlinkage int 79long arch_ptrace(struct task_struct *child, long request, long addr, long data)
80sys_ptrace(long request, long pid, long addr, long data)
81{ 80{
82 struct task_struct *child;
83 int ret; 81 int ret;
84 unsigned long __user *datap = (unsigned long __user *)data; 82 unsigned long __user *datap = (unsigned long __user *)data;
85 83
86 lock_kernel();
87 ret = -EPERM;
88
89 if (request == PTRACE_TRACEME) {
90 /* are we already being traced? */
91 if (current->ptrace & PT_PTRACED)
92 goto out;
93 ret = security_ptrace(current->parent, current);
94 if (ret)
95 goto out;
96 /* set the ptrace bit in the process flags. */
97 current->ptrace |= PT_PTRACED;
98 ret = 0;
99 goto out;
100 }
101
102 ret = -ESRCH;
103 read_lock(&tasklist_lock);
104 child = find_task_by_pid(pid);
105
106 if (child)
107 get_task_struct(child);
108
109 read_unlock(&tasklist_lock);
110
111 if (!child)
112 goto out;
113
114 ret = -EPERM;
115
116 if (pid == 1) /* Leave the init process alone! */
117 goto out_tsk;
118
119 if (request == PTRACE_ATTACH) {
120 ret = ptrace_attach(child);
121 goto out_tsk;
122 }
123
124 ret = ptrace_check_attach(child, request == PTRACE_KILL);
125 if (ret < 0)
126 goto out_tsk;
127
128 switch (request) { 84 switch (request) {
129 /* Read word at location address. */ 85 /* Read word at location address. */
130 case PTRACE_PEEKTEXT: 86 case PTRACE_PEEKTEXT:
@@ -289,10 +245,7 @@ sys_ptrace(long request, long pid, long addr, long data)
289 ret = ptrace_request(child, request, addr, data); 245 ret = ptrace_request(child, request, addr, data);
290 break; 246 break;
291 } 247 }
292out_tsk: 248
293 put_task_struct(child);
294out:
295 unlock_kernel();
296 return ret; 249 return ret;
297} 250}
298 251