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/m68knommu | |
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/m68knommu')
-rw-r--r-- | arch/m68knommu/kernel/ptrace.c | 39 |
1 files changed, 1 insertions, 38 deletions
diff --git a/arch/m68knommu/kernel/ptrace.c b/arch/m68knommu/kernel/ptrace.c index 621d7b91ccfe..262ab8c72e5f 100644 --- a/arch/m68knommu/kernel/ptrace.c +++ b/arch/m68knommu/kernel/ptrace.c | |||
@@ -101,43 +101,10 @@ void ptrace_disable(struct task_struct *child) | |||
101 | put_reg(child, PT_SR, tmp); | 101 | put_reg(child, PT_SR, tmp); |
102 | } | 102 | } |
103 | 103 | ||
104 | asmlinkage long sys_ptrace(long request, long pid, long addr, long data) | 104 | long arch_ptrace(truct task_struct *child, long request, long addr, long data) |
105 | { | 105 | { |
106 | struct task_struct *child; | ||
107 | int ret; | 106 | int ret; |
108 | 107 | ||
109 | lock_kernel(); | ||
110 | ret = -EPERM; | ||
111 | if (request == PTRACE_TRACEME) { | ||
112 | /* are we already being traced? */ | ||
113 | if (current->ptrace & PT_PTRACED) | ||
114 | goto out; | ||
115 | /* set the ptrace bit in the process flags. */ | ||
116 | current->ptrace |= PT_PTRACED; | ||
117 | ret = 0; | ||
118 | goto out; | ||
119 | } | ||
120 | ret = -ESRCH; | ||
121 | read_lock(&tasklist_lock); | ||
122 | child = find_task_by_pid(pid); | ||
123 | if (child) | ||
124 | get_task_struct(child); | ||
125 | read_unlock(&tasklist_lock); | ||
126 | if (!child) | ||
127 | goto out; | ||
128 | |||
129 | ret = -EPERM; | ||
130 | if (pid == 1) /* you may not mess with init */ | ||
131 | goto out_tsk; | ||
132 | |||
133 | if (request == PTRACE_ATTACH) { | ||
134 | ret = ptrace_attach(child); | ||
135 | goto out_tsk; | ||
136 | } | ||
137 | ret = ptrace_check_attach(child, request == PTRACE_KILL); | ||
138 | if (ret < 0) | ||
139 | goto out_tsk; | ||
140 | |||
141 | switch (request) { | 108 | switch (request) { |
142 | /* when I and D space are separate, these will need to be fixed. */ | 109 | /* when I and D space are separate, these will need to be fixed. */ |
143 | case PTRACE_PEEKTEXT: /* read word at location addr. */ | 110 | case PTRACE_PEEKTEXT: /* read word at location addr. */ |
@@ -357,10 +324,6 @@ asmlinkage long sys_ptrace(long request, long pid, long addr, long data) | |||
357 | ret = -EIO; | 324 | ret = -EIO; |
358 | break; | 325 | break; |
359 | } | 326 | } |
360 | out_tsk: | ||
361 | put_task_struct(child); | ||
362 | out: | ||
363 | unlock_kernel(); | ||
364 | return ret; | 327 | return ret; |
365 | } | 328 | } |
366 | 329 | ||