Commit a62e0c44 authored by Matthew Wilcox's avatar Matthew Wilcox Committed by Linus Torvalds

[PATCH] Remove another for_each_process loop

Convert send_sigurg() to the for_each_task_pid() mechanism.  Also in
the case where we were trying to send a signal to a non-existent PID,
don't bother searching for -PID in the PGID array; we won't find it.
parent b1c725a7
...@@ -491,15 +491,17 @@ void send_sigio(struct fown_struct *fown, int fd, int band) ...@@ -491,15 +491,17 @@ void send_sigio(struct fown_struct *fown, int fd, int band)
goto out_unlock_fown; goto out_unlock_fown;
read_lock(&tasklist_lock); read_lock(&tasklist_lock);
if ( (pid > 0) && (p = find_task_by_pid(pid)) ) { if (pid > 0) {
if (p = find_task_by_pid(pid)) {
send_sigio_to_task(p, fown, fd, band); send_sigio_to_task(p, fown, fd, band);
goto out_unlock_task;
} }
for_each_task_pid(-pid, PIDTYPE_PGID, p, l, pidptr) } else {
send_sigio_to_task(p, fown,fd,band); for_each_task_pid(-pid, PIDTYPE_PGID, p, l, pidptr) {
out_unlock_task: send_sigio_to_task(p, fown, fd, band);
}
}
read_unlock(&tasklist_lock); read_unlock(&tasklist_lock);
out_unlock_fown: out_unlock_fown:
read_unlock(&fown->lock); read_unlock(&fown->lock);
} }
...@@ -523,21 +525,17 @@ int send_sigurg(struct fown_struct *fown) ...@@ -523,21 +525,17 @@ int send_sigurg(struct fown_struct *fown)
ret = 1; ret = 1;
read_lock(&tasklist_lock); read_lock(&tasklist_lock);
if ((pid > 0) && (p = find_task_by_pid(pid))) { if (pid > 0) {
if (p = find_task_by_pid(pid)) {
send_sigurg_to_task(p, fown); send_sigurg_to_task(p, fown);
goto out_unlock_task;
} }
for_each_process(p) { } else {
int match = p->pid; for_each_task_pid(-pid, PIDTYPE_PGID, p, l, pidptr) {
if (pid < 0)
match = -p->pgrp;
if (pid != match)
continue;
send_sigurg_to_task(p, fown); send_sigurg_to_task(p, fown);
} }
out_unlock_task: }
read_unlock(&tasklist_lock); read_unlock(&tasklist_lock);
out_unlock_fown: out_unlock_fown:
read_unlock(&fown->lock); read_unlock(&fown->lock);
return ret; return ret;
} }
......
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