patch-2.1.8 linux/kernel/sched.c

Next file: linux/kernel/sysctl.c
Previous file: linux/kernel/module.c
Back to the patch index
Back to the overall index

diff -u --recursive --new-file v2.1.7/linux/kernel/sched.c linux/kernel/sched.c
@@ -1192,20 +1192,19 @@
 
 #endif
 
-static struct task_struct *find_process_by_pid(pid_t pid) {
-	struct task_struct *p, *q;
+static struct task_struct *find_process_by_pid(pid_t pid)
+{
+	struct task_struct *p;
 
-	if (pid == 0)
-		p = current;
-	else {
-		p = 0;
-		for_each_task(q) {
-			if (q && q->pid == pid) {
-				p = q;
-				break;
-			}
+	p = current;
+	if (pid) {
+		for_each_task(p) {
+			if (p->pid == pid)
+				goto found;
 		}
+		p = NULL;
 	}
+found:
 	return p;
 }
 

FUNET's LINUX-ADM group, linux-adm@nic.funet.fi
TCL-scripts by Sam Shen, slshen@lbl.gov