diff options
author | Christoph Hellwig <hch@lst.de> | 2005-11-07 03:59:47 -0500 |
---|---|---|
committer | Linus Torvalds <torvalds@g5.osdl.org> | 2005-11-07 10:53:42 -0500 |
commit | 481bed454247538e9f57d4ea37b153ccba24ba7b (patch) | |
tree | bb4198296962c08dbf52e8f377dc27206f621640 /arch/v850 | |
parent | db73e9aa99bf093427b79877f9475392724fd5e5 (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/v850')
-rw-r--r-- | arch/v850/kernel/ptrace.c | 43 |
1 files changed, 2 insertions, 41 deletions
diff --git a/arch/v850/kernel/ptrace.c b/arch/v850/kernel/ptrace.c index d6077ff47d22..18492d02aaf6 100644 --- a/arch/v850/kernel/ptrace.c +++ b/arch/v850/kernel/ptrace.c | |||
@@ -113,45 +113,10 @@ static int set_single_step (struct task_struct *t, int val) | |||
113 | return 1; | 113 | return 1; |
114 | } | 114 | } |
115 | 115 | ||
116 | long sys_ptrace(long request, long pid, long addr, long data) | 116 | long arch_ptrace(struct task_struct *child, long request, long addr, long data) |
117 | { | 117 | { |
118 | struct task_struct *child; | ||
119 | int rval; | 118 | int rval; |
120 | 119 | ||
121 | lock_kernel(); | ||
122 | |||
123 | if (request == PTRACE_TRACEME) { | ||
124 | /* are we already being traced? */ | ||
125 | if (current->ptrace & PT_PTRACED) { | ||
126 | rval = -EPERM; | ||
127 | goto out; | ||
128 | } | ||
129 | /* set the ptrace bit in the process flags. */ | ||
130 | current->ptrace |= PT_PTRACED; | ||
131 | rval = 0; | ||
132 | goto out; | ||
133 | } | ||
134 | rval = -ESRCH; | ||
135 | read_lock(&tasklist_lock); | ||
136 | child = find_task_by_pid(pid); | ||
137 | if (child) | ||
138 | get_task_struct(child); | ||
139 | read_unlock(&tasklist_lock); | ||
140 | if (!child) | ||
141 | goto out; | ||
142 | |||
143 | rval = -EPERM; | ||
144 | if (pid == 1) /* you may not mess with init */ | ||
145 | goto out_tsk; | ||
146 | |||
147 | if (request == PTRACE_ATTACH) { | ||
148 | rval = ptrace_attach(child); | ||
149 | goto out_tsk; | ||
150 | } | ||
151 | rval = ptrace_check_attach(child, request == PTRACE_KILL); | ||
152 | if (rval < 0) | ||
153 | goto out_tsk; | ||
154 | |||
155 | switch (request) { | 120 | switch (request) { |
156 | unsigned long val, copied; | 121 | unsigned long val, copied; |
157 | 122 | ||
@@ -248,11 +213,7 @@ long sys_ptrace(long request, long pid, long addr, long data) | |||
248 | rval = -EIO; | 213 | rval = -EIO; |
249 | goto out; | 214 | goto out; |
250 | } | 215 | } |
251 | 216 | out: | |
252 | out_tsk: | ||
253 | put_task_struct(child); | ||
254 | out: | ||
255 | unlock_kernel(); | ||
256 | return rval; | 217 | return rval; |
257 | } | 218 | } |
258 | 219 | ||