Commit 9b42bb75 authored by Peter Hurley's avatar Peter Hurley Committed by Greg Kroah-Hartman

tty: Convert SAK messages to tty_notice()

Use tty_notice() for unified message format from the tty core.
Fix each message to accurately reflect the cause of each termination.
Signed-off-by: default avatarPeter Hurley <peter@hurleysoftware.com>
Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
parent 339f36ba
...@@ -3026,28 +3026,24 @@ void __do_SAK(struct tty_struct *tty) ...@@ -3026,28 +3026,24 @@ void __do_SAK(struct tty_struct *tty)
read_lock(&tasklist_lock); read_lock(&tasklist_lock);
/* Kill the entire session */ /* Kill the entire session */
do_each_pid_task(session, PIDTYPE_SID, p) { do_each_pid_task(session, PIDTYPE_SID, p) {
printk(KERN_NOTICE "SAK: killed process %d" tty_notice(tty, "SAK: killed process %d (%s): by session\n",
" (%s): task_session(p)==tty->session\n", task_pid_nr(p), p->comm);
task_pid_nr(p), p->comm);
send_sig(SIGKILL, p, 1); send_sig(SIGKILL, p, 1);
} while_each_pid_task(session, PIDTYPE_SID, p); } while_each_pid_task(session, PIDTYPE_SID, p);
/* Now kill any processes that happen to have the
* tty open. /* Now kill any processes that happen to have the tty open */
*/
do_each_thread(g, p) { do_each_thread(g, p) {
if (p->signal->tty == tty) { if (p->signal->tty == tty) {
printk(KERN_NOTICE "SAK: killed process %d" tty_notice(tty, "SAK: killed process %d (%s): by controlling tty\n",
" (%s): task_session(p)==tty->session\n", task_pid_nr(p), p->comm);
task_pid_nr(p), p->comm);
send_sig(SIGKILL, p, 1); send_sig(SIGKILL, p, 1);
continue; continue;
} }
task_lock(p); task_lock(p);
i = iterate_fd(p->files, 0, this_tty, tty); i = iterate_fd(p->files, 0, this_tty, tty);
if (i != 0) { if (i != 0) {
printk(KERN_NOTICE "SAK: killed process %d" tty_notice(tty, "SAK: killed process %d (%s): by fd#%d\n",
" (%s): fd#%d opened to the tty\n", task_pid_nr(p), p->comm, i - 1);
task_pid_nr(p), p->comm, i - 1);
force_sig(SIGKILL, p); force_sig(SIGKILL, p);
} }
task_unlock(p); task_unlock(p);
......
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