Commit 82184668 authored by Andrew Morton's avatar Andrew Morton Committed by Linus Torvalds

[PATCH] Use for_each_task_pid() in do_SAK()

Patch from Bill Irwin.

__do_SAK() simply wants to kill off processes using a given tty.  This
converts it to use for_each_task_pid().
parent 1cf1d22a
...@@ -1836,6 +1836,8 @@ static void __do_SAK(void *arg) ...@@ -1836,6 +1836,8 @@ static void __do_SAK(void *arg)
#else #else
struct tty_struct *tty = arg; struct tty_struct *tty = arg;
struct task_struct *p; struct task_struct *p;
struct list_head *l;
struct pid *pid;
int session; int session;
int i; int i;
struct file *filp; struct file *filp;
...@@ -1848,9 +1850,8 @@ static void __do_SAK(void *arg) ...@@ -1848,9 +1850,8 @@ static void __do_SAK(void *arg)
if (tty->driver.flush_buffer) if (tty->driver.flush_buffer)
tty->driver.flush_buffer(tty); tty->driver.flush_buffer(tty);
read_lock(&tasklist_lock); read_lock(&tasklist_lock);
for_each_process(p) { for_each_task_pid(session, PIDTYPE_SID, p, l, pid) {
if ((p->tty == tty) || if (p->tty == tty || session > 0) {
((session > 0) && (p->session == session))) {
printk(KERN_NOTICE "SAK: killed process %d" printk(KERN_NOTICE "SAK: killed process %d"
" (%s): p->session==tty->session\n", " (%s): p->session==tty->session\n",
p->pid, p->comm); p->pid, p->comm);
......
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