Forgot about this patch...

Since we have syscall_code() anyway, make it a bit more useful.

---

 kernel/ptrace.c |   20 ++++++++++----------
 1 file changed, 10 insertions(+), 10 deletions(-)

--- PU/kernel/ptrace.c~70_TWEAK_SYSCALL_CODE    2009-10-06 02:24:36.000000000 
+0200
+++ PU/kernel/ptrace.c  2009-10-06 02:25:02.000000000 +0200
@@ -210,10 +210,11 @@ static u32 ptrace_report_clone(enum utra
        return ret;
 }
 
-static inline int syscall_code(struct ptrace_context *context)
+static inline int syscall_code(struct ptrace_context *context, int event)
 {
-       return  (context->options & PTRACE_O_TRACESYSGOOD) ?
-               (SIGTRAP | 0x80) : SIGTRAP;
+       int code = (context->options & PTRACE_O_TRACESYSGOOD) ?
+                       (SIGTRAP | 0x80) : SIGTRAP;
+       return (event << 8) | code;
 }
 
 static u32 ptrace_report_syscall_entry(u32 action,
@@ -225,8 +226,7 @@ static u32 ptrace_report_syscall_entry(u
 
        WARN_ON(ev_pending(context));
 
-       context->ev_code = (PTRACE_EVENT_SYSCALL_ENTRY << 8) |
-                               syscall_code(context);
+       context->ev_code = syscall_code(context, PTRACE_EVENT_SYSCALL_ENTRY);
 
        return UTRACE_SYSCALL_RUN | UTRACE_STOP;
 }
@@ -241,8 +241,7 @@ static u32 ptrace_report_syscall_exit(en
        if (ev_pending(context))
                return UTRACE_STOP;
 
-       context->ev_code = (PTRACE_EVENT_SYSCALL_EXIT << 8) |
-                               syscall_code(context);
+       context->ev_code = syscall_code(context, PTRACE_EVENT_SYSCALL_EXIT);
 
        return UTRACE_STOP;
 }
@@ -936,8 +935,8 @@ static void do_ptrace_resume(struct utra
                case PTRACE_EVENT_FORK:
                case PTRACE_EVENT_CLONE:
                case PTRACE_EVENT_VFORK_DONE:
-                       context->ev_code = (PTRACE_EVENT_SYSCALL_EXIT << 8) |
-                                               syscall_code(context);
+                       context->ev_code = syscall_code(context,
+                                               PTRACE_EVENT_SYSCALL_EXIT);
                        do_ptrace_notify_stop(context, tracee);
                        return;
                }
@@ -951,7 +950,8 @@ static void do_ptrace_resume(struct utra
                case PTRACE_EVENT_SYSCALL_EXIT:
                        read_lock(&tasklist_lock);
                        if (tracee->sighand)
-                               send_sigtrap(tracee, task_pt_regs(tracee), 0, 
TRAP_BRKPT);
+                               send_sigtrap(tracee, task_pt_regs(tracee),
+                                               0, TRAP_BRKPT);
                        read_unlock(&tasklist_lock);
 
                        action = UTRACE_RESUME;

Reply via email to