diff options
author | Roland McGrath <roland@redhat.com> | 2008-07-25 22:45:55 -0400 |
---|---|---|
committer | Linus Torvalds <torvalds@linux-foundation.org> | 2008-07-26 15:00:09 -0400 |
commit | b787f7ba677840da16a2228c16571ce8a1fcb799 (patch) | |
tree | b1838c4ae7f38c00efc2375871a255275500f245 | |
parent | 2b2a1ff64afbadac842bbc58c5166962cf4f7664 (diff) |
tracehook: force signal_pending()
This defines a new hook tracehook_force_sigpending() that lets tracing
code decide to force TIF_SIGPENDING on in recalc_sigpending().
This is not used yet, so it compiles away to nothing for now. It lays the
groundwork for new tracing code that can interrupt a task synthetically
without actually sending a signal.
Signed-off-by: Roland McGrath <roland@redhat.com>
Cc: Oleg Nesterov <oleg@tv-sign.ru>
Reviewed-by: Ingo Molnar <mingo@elte.hu>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
-rw-r--r-- | include/linux/tracehook.h | 14 | ||||
-rw-r--r-- | kernel/signal.c | 4 |
2 files changed, 17 insertions, 1 deletions
diff --git a/include/linux/tracehook.h b/include/linux/tracehook.h index 4c50e1b57349..43bc51b6bd33 100644 --- a/include/linux/tracehook.h +++ b/include/linux/tracehook.h | |||
@@ -423,6 +423,20 @@ static inline int tracehook_consider_fatal_signal(struct task_struct *task, | |||
423 | } | 423 | } |
424 | 424 | ||
425 | /** | 425 | /** |
426 | * tracehook_force_sigpending - let tracing force signal_pending(current) on | ||
427 | * | ||
428 | * Called when recomputing our signal_pending() flag. Return nonzero | ||
429 | * to force the signal_pending() flag on, so that tracehook_get_signal() | ||
430 | * will be called before the next return to user mode. | ||
431 | * | ||
432 | * Called with @current->sighand->siglock held. | ||
433 | */ | ||
434 | static inline int tracehook_force_sigpending(void) | ||
435 | { | ||
436 | return 0; | ||
437 | } | ||
438 | |||
439 | /** | ||
426 | * tracehook_get_signal - deliver synthetic signal to traced task | 440 | * tracehook_get_signal - deliver synthetic signal to traced task |
427 | * @task: @current | 441 | * @task: @current |
428 | * @regs: task_pt_regs(@current) | 442 | * @regs: task_pt_regs(@current) |
diff --git a/kernel/signal.c b/kernel/signal.c index 0e862d3130ff..954f77d7e3bc 100644 --- a/kernel/signal.c +++ b/kernel/signal.c | |||
@@ -134,7 +134,9 @@ void recalc_sigpending_and_wake(struct task_struct *t) | |||
134 | 134 | ||
135 | void recalc_sigpending(void) | 135 | void recalc_sigpending(void) |
136 | { | 136 | { |
137 | if (!recalc_sigpending_tsk(current) && !freezing(current)) | 137 | if (unlikely(tracehook_force_sigpending())) |
138 | set_thread_flag(TIF_SIGPENDING); | ||
139 | else if (!recalc_sigpending_tsk(current) && !freezing(current)) | ||
138 | clear_thread_flag(TIF_SIGPENDING); | 140 | clear_thread_flag(TIF_SIGPENDING); |
139 | 141 | ||
140 | } | 142 | } |