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/arm26 | |
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/arm26')
-rw-r--r-- | arch/arm26/kernel/ptrace.c | 49 |
1 files changed, 1 insertions, 48 deletions
diff --git a/arch/arm26/kernel/ptrace.c b/arch/arm26/kernel/ptrace.c index cf7e977d18c8..4e6b7356a722 100644 --- a/arch/arm26/kernel/ptrace.c +++ b/arch/arm26/kernel/ptrace.c | |||
@@ -546,7 +546,7 @@ static int ptrace_setfpregs(struct task_struct *tsk, void *ufp) | |||
546 | sizeof(struct user_fp)) ? -EFAULT : 0; | 546 | sizeof(struct user_fp)) ? -EFAULT : 0; |
547 | } | 547 | } |
548 | 548 | ||
549 | static int do_ptrace(int request, struct task_struct *child, long addr, long data) | 549 | long arch_ptrace(struct task_struct *child, long request, long addr, long data) |
550 | { | 550 | { |
551 | unsigned long tmp; | 551 | unsigned long tmp; |
552 | int ret; | 552 | int ret; |
@@ -665,53 +665,6 @@ static int do_ptrace(int request, struct task_struct *child, long addr, long dat | |||
665 | return ret; | 665 | return ret; |
666 | } | 666 | } |
667 | 667 | ||
668 | asmlinkage long sys_ptrace(long request, long pid, long addr, long data) | ||
669 | { | ||
670 | struct task_struct *child; | ||
671 | int ret; | ||
672 | |||
673 | lock_kernel(); | ||
674 | ret = -EPERM; | ||
675 | if (request == PTRACE_TRACEME) { | ||
676 | /* are we already being traced? */ | ||
677 | if (current->ptrace & PT_PTRACED) | ||
678 | goto out; | ||
679 | ret = security_ptrace(current->parent, current); | ||
680 | if (ret) | ||
681 | goto out; | ||
682 | /* set the ptrace bit in the process flags. */ | ||
683 | current->ptrace |= PT_PTRACED; | ||
684 | ret = 0; | ||
685 | goto out; | ||
686 | } | ||
687 | ret = -ESRCH; | ||
688 | read_lock(&tasklist_lock); | ||
689 | child = find_task_by_pid(pid); | ||
690 | if (child) | ||
691 | get_task_struct(child); | ||
692 | read_unlock(&tasklist_lock); | ||
693 | if (!child) | ||
694 | goto out; | ||
695 | |||
696 | ret = -EPERM; | ||
697 | if (pid == 1) /* you may not mess with init */ | ||
698 | goto out_tsk; | ||
699 | |||
700 | if (request == PTRACE_ATTACH) { | ||
701 | ret = ptrace_attach(child); | ||
702 | goto out_tsk; | ||
703 | } | ||
704 | ret = ptrace_check_attach(child, request == PTRACE_KILL); | ||
705 | if (ret == 0) | ||
706 | ret = do_ptrace(request, child, addr, data); | ||
707 | |||
708 | out_tsk: | ||
709 | put_task_struct(child); | ||
710 | out: | ||
711 | unlock_kernel(); | ||
712 | return ret; | ||
713 | } | ||
714 | |||
715 | asmlinkage void syscall_trace(int why, struct pt_regs *regs) | 668 | asmlinkage void syscall_trace(int why, struct pt_regs *regs) |
716 | { | 669 | { |
717 | unsigned long ip; | 670 | unsigned long ip; |