diff options
author | Tejun Heo <tj@kernel.org> | 2011-06-17 10:50:34 -0400 |
---|---|---|
committer | Oleg Nesterov <oleg@redhat.com> | 2011-06-22 13:26:27 -0400 |
commit | d21142ece414ce1088cfcae760689aa60d6fee80 (patch) | |
tree | 9f97b4518cd06fe695476fc6cc4ff9ed8d5bdd58 /kernel | |
parent | 544b2c91a9f14f9565af1972203438b7f49afd48 (diff) |
ptrace: kill task_ptrace()
task_ptrace(task) simply dereferences task->ptrace and isn't even used
consistently only adding confusion. Kill it and directly access
->ptrace instead.
This doesn't introduce any behavior change.
Signed-off-by: Tejun Heo <tj@kernel.org>
Signed-off-by: Oleg Nesterov <oleg@redhat.com>
Diffstat (limited to 'kernel')
-rw-r--r-- | kernel/exit.c | 8 | ||||
-rw-r--r-- | kernel/signal.c | 14 |
2 files changed, 11 insertions, 11 deletions
diff --git a/kernel/exit.c b/kernel/exit.c index 289f59d686bf..e5cc05644609 100644 --- a/kernel/exit.c +++ b/kernel/exit.c | |||
@@ -765,7 +765,7 @@ static void reparent_leader(struct task_struct *father, struct task_struct *p, | |||
765 | p->exit_signal = SIGCHLD; | 765 | p->exit_signal = SIGCHLD; |
766 | 766 | ||
767 | /* If it has exited notify the new parent about this child's death. */ | 767 | /* If it has exited notify the new parent about this child's death. */ |
768 | if (!task_ptrace(p) && | 768 | if (!p->ptrace && |
769 | p->exit_state == EXIT_ZOMBIE && thread_group_empty(p)) { | 769 | p->exit_state == EXIT_ZOMBIE && thread_group_empty(p)) { |
770 | do_notify_parent(p, p->exit_signal); | 770 | do_notify_parent(p, p->exit_signal); |
771 | if (task_detached(p)) { | 771 | if (task_detached(p)) { |
@@ -795,7 +795,7 @@ static void forget_original_parent(struct task_struct *father) | |||
795 | do { | 795 | do { |
796 | t->real_parent = reaper; | 796 | t->real_parent = reaper; |
797 | if (t->parent == father) { | 797 | if (t->parent == father) { |
798 | BUG_ON(task_ptrace(t)); | 798 | BUG_ON(t->ptrace); |
799 | t->parent = t->real_parent; | 799 | t->parent = t->real_parent; |
800 | } | 800 | } |
801 | if (t->pdeath_signal) | 801 | if (t->pdeath_signal) |
@@ -1565,7 +1565,7 @@ static int wait_consider_task(struct wait_opts *wo, int ptrace, | |||
1565 | * Notification and reaping will be cascaded to the real | 1565 | * Notification and reaping will be cascaded to the real |
1566 | * parent when the ptracer detaches. | 1566 | * parent when the ptracer detaches. |
1567 | */ | 1567 | */ |
1568 | if (likely(!ptrace) && unlikely(task_ptrace(p))) { | 1568 | if (likely(!ptrace) && unlikely(p->ptrace)) { |
1569 | /* it will become visible, clear notask_error */ | 1569 | /* it will become visible, clear notask_error */ |
1570 | wo->notask_error = 0; | 1570 | wo->notask_error = 0; |
1571 | return 0; | 1571 | return 0; |
@@ -1608,7 +1608,7 @@ static int wait_consider_task(struct wait_opts *wo, int ptrace, | |||
1608 | * own children, it should create a separate process which | 1608 | * own children, it should create a separate process which |
1609 | * takes the role of real parent. | 1609 | * takes the role of real parent. |
1610 | */ | 1610 | */ |
1611 | if (likely(!ptrace) && task_ptrace(p) && | 1611 | if (likely(!ptrace) && p->ptrace && |
1612 | same_thread_group(p->parent, p->real_parent)) | 1612 | same_thread_group(p->parent, p->real_parent)) |
1613 | return 0; | 1613 | return 0; |
1614 | 1614 | ||
diff --git a/kernel/signal.c b/kernel/signal.c index 97e575a3387e..0f3370872506 100644 --- a/kernel/signal.c +++ b/kernel/signal.c | |||
@@ -1592,7 +1592,7 @@ int do_notify_parent(struct task_struct *tsk, int sig) | |||
1592 | /* do_notify_parent_cldstop should have been called instead. */ | 1592 | /* do_notify_parent_cldstop should have been called instead. */ |
1593 | BUG_ON(task_is_stopped_or_traced(tsk)); | 1593 | BUG_ON(task_is_stopped_or_traced(tsk)); |
1594 | 1594 | ||
1595 | BUG_ON(!task_ptrace(tsk) && | 1595 | BUG_ON(!tsk->ptrace && |
1596 | (tsk->group_leader != tsk || !thread_group_empty(tsk))); | 1596 | (tsk->group_leader != tsk || !thread_group_empty(tsk))); |
1597 | 1597 | ||
1598 | info.si_signo = sig; | 1598 | info.si_signo = sig; |
@@ -1631,7 +1631,7 @@ int do_notify_parent(struct task_struct *tsk, int sig) | |||
1631 | 1631 | ||
1632 | psig = tsk->parent->sighand; | 1632 | psig = tsk->parent->sighand; |
1633 | spin_lock_irqsave(&psig->siglock, flags); | 1633 | spin_lock_irqsave(&psig->siglock, flags); |
1634 | if (!task_ptrace(tsk) && sig == SIGCHLD && | 1634 | if (!tsk->ptrace && sig == SIGCHLD && |
1635 | (psig->action[SIGCHLD-1].sa.sa_handler == SIG_IGN || | 1635 | (psig->action[SIGCHLD-1].sa.sa_handler == SIG_IGN || |
1636 | (psig->action[SIGCHLD-1].sa.sa_flags & SA_NOCLDWAIT))) { | 1636 | (psig->action[SIGCHLD-1].sa.sa_flags & SA_NOCLDWAIT))) { |
1637 | /* | 1637 | /* |
@@ -1731,7 +1731,7 @@ static void do_notify_parent_cldstop(struct task_struct *tsk, | |||
1731 | 1731 | ||
1732 | static inline int may_ptrace_stop(void) | 1732 | static inline int may_ptrace_stop(void) |
1733 | { | 1733 | { |
1734 | if (!likely(task_ptrace(current))) | 1734 | if (!likely(current->ptrace)) |
1735 | return 0; | 1735 | return 0; |
1736 | /* | 1736 | /* |
1737 | * Are we in the middle of do_coredump? | 1737 | * Are we in the middle of do_coredump? |
@@ -1989,7 +1989,7 @@ static bool do_signal_stop(int signr) | |||
1989 | if (!(sig->flags & SIGNAL_STOP_STOPPED)) | 1989 | if (!(sig->flags & SIGNAL_STOP_STOPPED)) |
1990 | sig->group_exit_code = signr; | 1990 | sig->group_exit_code = signr; |
1991 | else | 1991 | else |
1992 | WARN_ON_ONCE(!task_ptrace(current)); | 1992 | WARN_ON_ONCE(!current->ptrace); |
1993 | 1993 | ||
1994 | sig->group_stop_count = 0; | 1994 | sig->group_stop_count = 0; |
1995 | 1995 | ||
@@ -2014,7 +2014,7 @@ static bool do_signal_stop(int signr) | |||
2014 | } | 2014 | } |
2015 | } | 2015 | } |
2016 | 2016 | ||
2017 | if (likely(!task_ptrace(current))) { | 2017 | if (likely(!current->ptrace)) { |
2018 | int notify = 0; | 2018 | int notify = 0; |
2019 | 2019 | ||
2020 | /* | 2020 | /* |
@@ -2093,7 +2093,7 @@ static void do_jobctl_trap(void) | |||
2093 | static int ptrace_signal(int signr, siginfo_t *info, | 2093 | static int ptrace_signal(int signr, siginfo_t *info, |
2094 | struct pt_regs *regs, void *cookie) | 2094 | struct pt_regs *regs, void *cookie) |
2095 | { | 2095 | { |
2096 | if (!task_ptrace(current)) | 2096 | if (!current->ptrace) |
2097 | return signr; | 2097 | return signr; |
2098 | 2098 | ||
2099 | ptrace_signal_deliver(regs, cookie); | 2099 | ptrace_signal_deliver(regs, cookie); |
@@ -2179,7 +2179,7 @@ relock: | |||
2179 | do_notify_parent_cldstop(current, false, why); | 2179 | do_notify_parent_cldstop(current, false, why); |
2180 | 2180 | ||
2181 | leader = current->group_leader; | 2181 | leader = current->group_leader; |
2182 | if (task_ptrace(leader) && !real_parent_is_ptracer(leader)) | 2182 | if (leader->ptrace && !real_parent_is_ptracer(leader)) |
2183 | do_notify_parent_cldstop(leader, true, why); | 2183 | do_notify_parent_cldstop(leader, true, why); |
2184 | 2184 | ||
2185 | read_unlock(&tasklist_lock); | 2185 | read_unlock(&tasklist_lock); |