--- 2.6/fs/proc/base.c 2003-12-20 09:19:13.000000000 +0100 +++ build-2.6/fs/proc/base.c 2004-01-06 10:50:35.000000000 +0100 @@ -1631,14 +1631,23 @@ * 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_tgid_list(int index, unsigned int *tgids) +static int get_tgid_list(int index, unsigned long version, unsigned int *tgids) { struct task_struct *p; int nr_tgids = 0; index--; read_lock(&tasklist_lock); - for_each_process(p) { + p = NULL; + if (version) + p = find_task_by_pid(version); + + if (p) + index = 0; + else + p = next_task(&init_task); + + for ( ; p != &init_task; p = next_task(p)) { int tgid = p->pid; if (!pid_alive(p)) continue; @@ -1701,7 +1710,7 @@ nr++; } - nr_tgids = get_tgid_list(nr, tgid_array); + nr_tgids = get_tgid_list(nr, filp->f_version, tgid_array); for (i = 0; i < nr_tgids; i++) { int tgid = tgid_array[i]; @@ -1710,8 +1719,10 @@ do buf[--j] = '0' + (tgid % 10); while (tgid/=10); - if (filldir(dirent, buf+j, PROC_NUMBUF-j, filp->f_pos, ino, DT_DIR) < 0) + if (filldir(dirent, buf+j, PROC_NUMBUF-j, filp->f_pos, ino, DT_DIR) < 0) { + filp->f_version = tgid; break; + } filp->f_pos++; } return 0;