patch-2.1.118 linux/fs/proc/root.c

Next file: linux/fs/proc/scsi.c
Previous file: linux/fs/proc/openpromfs.c
Back to the patch index
Back to the overall index

diff -u --recursive --new-file v2.1.117/linux/fs/proc/root.c linux/fs/proc/root.c
@@ -50,6 +50,7 @@
 	NULL,			/* ioctl - default */
 	NULL,			/* mmap */
 	NULL,			/* no special open code */
+	NULL,			/* flush */
 	NULL,			/* no special release code */
 	NULL			/* can't fsync */
 };
@@ -117,6 +118,7 @@
 	NULL,			/* ioctl - default */
 	NULL,			/* mmap */
 	NULL,			/* no special open code */
+	NULL,			/* flush */
 	NULL,			/* no special release code */
 	NULL			/* no fsync */
 };
@@ -276,6 +278,7 @@
 	NULL,			/* ioctl - default */
 	NULL,			/* mmap */
 	NULL,			/* no special open code */
+	NULL,			/* flush */
 	NULL,			/* no special release code */
 	NULL			/* can't fsync */
 };
@@ -901,19 +904,18 @@
  * tasklist lock while doing this, and we must release it before
  * we actually do the filldir itself, so we use a temp buffer..
  */
-static int get_pid_list(unsigned int index, unsigned int *pids)
+static int get_pid_list(int index, unsigned int *pids)
 {
 	struct task_struct *p;
-	int nr = FIRST_PROCESS_ENTRY;
 	int nr_pids = 0;
 
+	index -= FIRST_PROCESS_ENTRY;
 	read_lock(&tasklist_lock);
 	for_each_task(p) {
-		int pid;
-		if (nr++ < index)
-			continue;
-		pid = p->pid;
+		int pid = p->pid;
 		if (!pid)
+			continue;
+		if (--index >= 0)
 			continue;
 		pids[nr_pids] = pid;
 		nr_pids++;

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