Commit 021e1ae3 authored by Oleg Nesterov's avatar Oleg Nesterov Committed by Linus Torvalds

signals: document CLD_CONTINUED notification mechanics

A couple of small comments about how CLD_CONTINUED notification works.
Signed-off-by: default avatarOleg Nesterov <oleg@tv-sign.ru>
Cc: Roland McGrath <roland@redhat.com>
Signed-off-by: default avatarAndrew Morton <akpm@linux-foundation.org>
Signed-off-by: default avatarLinus Torvalds <torvalds@linux-foundation.org>
parent 7e695a5e
...@@ -633,6 +633,11 @@ static int prepare_signal(int sig, struct task_struct *p) ...@@ -633,6 +633,11 @@ static int prepare_signal(int sig, struct task_struct *p)
why |= SIGNAL_CLD_STOPPED; why |= SIGNAL_CLD_STOPPED;
if (why) { if (why) {
/*
* The first thread which returns from finish_stop()
* will take ->siglock, notice SIGNAL_CLD_MASK, and
* notify its parent. See get_signal_to_deliver().
*/
signal->flags = why | SIGNAL_STOP_CONTINUED; signal->flags = why | SIGNAL_STOP_CONTINUED;
signal->group_stop_count = 0; signal->group_stop_count = 0;
signal->group_exit_code = 0; signal->group_exit_code = 0;
...@@ -1694,7 +1699,11 @@ int get_signal_to_deliver(siginfo_t *info, struct k_sigaction *return_ka, ...@@ -1694,7 +1699,11 @@ int get_signal_to_deliver(siginfo_t *info, struct k_sigaction *return_ka,
try_to_freeze(); try_to_freeze();
spin_lock_irq(&sighand->siglock); spin_lock_irq(&sighand->siglock);
/*
* Every stopped thread goes here after wakeup. Check to see if
* we should notify the parent, prepare_signal(SIGCONT) encodes
* the CLD_ si_code into SIGNAL_CLD_MASK bits.
*/
if (unlikely(signal->flags & SIGNAL_CLD_MASK)) { if (unlikely(signal->flags & SIGNAL_CLD_MASK)) {
int why = (signal->flags & SIGNAL_STOP_CONTINUED) int why = (signal->flags & SIGNAL_STOP_CONTINUED)
? CLD_CONTINUED : CLD_STOPPED; ? CLD_CONTINUED : CLD_STOPPED;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment