Trivial, move the annoying PTRACE_O_TRACESYSGOOD check into the new helper, syscall_code().
--- kernel/ptrace.c | 18 ++++++++++++------ 1 file changed, 12 insertions(+), 6 deletions(-) --- PU/kernel/ptrace.c~66_SYSGOOD_HELPER 2009-10-06 00:50:01.000000000 +0200 +++ PU/kernel/ptrace.c 2009-10-06 01:11:40.000000000 +0200 @@ -207,6 +207,12 @@ static u32 ptrace_report_clone(enum utra return ret; } +static inline int syscall_code(struct ptrace_context *context) +{ + return (context->options & PTRACE_O_TRACESYSGOOD) ? + (SIGTRAP | 0x80) : SIGTRAP; +} + static u32 ptrace_report_syscall_entry(u32 action, struct utrace_engine *engine, struct task_struct *task, @@ -217,8 +223,8 @@ static u32 ptrace_report_syscall_entry(u WARN_ON(ev_pending(context)); context->ev_name = PTRACE_EVENT_SYSCALL_ENTRY; - context->ev_code = (context->options & PTRACE_O_TRACESYSGOOD) ? - (SIGTRAP | 0x80) : SIGTRAP; + context->ev_code = syscall_code(context); + return UTRACE_SYSCALL_RUN | UTRACE_STOP; } @@ -233,8 +239,8 @@ static u32 ptrace_report_syscall_exit(en return UTRACE_STOP; context->ev_name = PTRACE_EVENT_SYSCALL_EXIT; - context->ev_code = (context->options & PTRACE_O_TRACESYSGOOD) ? - (SIGTRAP | 0x80) : SIGTRAP; + context->ev_code = syscall_code(context); + return UTRACE_STOP; } @@ -931,8 +937,8 @@ static void do_ptrace_resume(struct utra case PTRACE_EVENT_CLONE: case PTRACE_EVENT_VFORK_DONE: context->ev_name = PTRACE_EVENT_SYSCALL_EXIT; - context->ev_code = (context->options & PTRACE_O_TRACESYSGOOD) ? - (SIGTRAP | 0x80) : SIGTRAP; + context->ev_code = syscall_code(context); + do_ptrace_notify_stop(context, tracee); return; }