[IA64] convert sys_ptrace to arch_ptrace
authorPetr Tesarik <ptesarik@suse.cz>
Mon, 11 Feb 2008 21:43:05 +0000 (22:43 +0100)
committerTony Luck <tony.luck@intel.com>
Wed, 5 Mar 2008 23:48:47 +0000 (15:48 -0800)
Convert sys_ptrace() to arch_ptrace().

Signed-off-by: Petr Tesarik <ptesarik@suse.cz>
Signed-off-by: Tony Luck <tony.luck@intel.com>
arch/ia64/kernel/ptrace.c
include/asm-ia64/ptrace.h

index e82fe296c2c0eaf8dc86eec50929fc38a91882f9..1dfff5a8f3658473629e0e32a2d2cac10bf0fb3b 100644 (file)
@@ -1470,46 +1470,13 @@ ptrace_disable (struct task_struct *child)
        child_psr->tb = 0;
 }
 
-asmlinkage long
-sys_ptrace (long request, pid_t pid, unsigned long addr, unsigned long data)
+long
+arch_ptrace (struct task_struct *child, long request, long addr, long data)
 {
        struct pt_regs *pt;
-       struct task_struct *child;
        struct switch_stack *sw;
        long ret;
 
-       lock_kernel();
-       ret = -EPERM;
-       if (request == PTRACE_TRACEME) {
-               ret = ptrace_traceme();
-               goto out;
-       }
-
-       ret = -ESRCH;
-       read_lock(&tasklist_lock);
-       {
-               child = find_task_by_pid(pid);
-               if (child)
-                       get_task_struct(child);
-       }
-       read_unlock(&tasklist_lock);
-       if (!child)
-               goto out;
-       ret = -EPERM;
-       if (pid == 1)           /* no messing around with init! */
-               goto out_tsk;
-
-       if (request == PTRACE_ATTACH) {
-               ret = ptrace_attach(child);
-               if (!ret)
-                       arch_ptrace_attach(child);
-               goto out_tsk;
-       }
-
-       ret = ptrace_check_attach(child, request == PTRACE_KILL);
-       if (ret < 0)
-               goto out_tsk;
-
        pt = task_pt_regs(child);
        sw = (struct switch_stack *) (child->thread.ksp + 16);
 
@@ -1594,7 +1561,7 @@ sys_ptrace (long request, pid_t pid, unsigned long addr, unsigned long data)
                 */
                if (child->exit_state == EXIT_ZOMBIE)
                        /* already dead */
-                       goto out_tsk;
+                       return 0;
                child->exit_code = SIGKILL;
 
                ptrace_disable(child);
@@ -1643,9 +1610,6 @@ sys_ptrace (long request, pid_t pid, unsigned long addr, unsigned long data)
                goto out_tsk;
        }
   out_tsk:
-       put_task_struct(child);
-  out:
-       unlock_kernel();
        return ret;
 }
 
index 0bdce7dde1b01b6f75067447b10d2a4b6d2c036a..5b5234098783213322de4a0ac846f49418e63d95 100644 (file)
@@ -233,8 +233,6 @@ struct switch_stack {
 #include <asm/current.h>
 #include <asm/page.h>
 
-#define __ARCH_SYS_PTRACE      1
-
 /*
  * We use the ia64_psr(regs)->ri to determine which of the three
  * instructions in bundle (16 bytes) took the sample. Generate