Hello,
This patch corrects the process iterator in procfs_readdir(), allowing
procfs root listing to work again. The iterator was stuck to the first
instance of allprocess list because all the relevant LIST_NEXT()
statements were mistakenly removed in revision 1.58 of procfs_vnops.c.
Regards,
Visa Hankala
Index: sys/miscfs/procfs/procfs_vnops.c
===================================================================
RCS file: /cvs/src/sys/miscfs/procfs/procfs_vnops.c,v
retrieving revision 1.60
diff -N -u -p sys/miscfs/procfs/procfs_vnops.c
--- sys/miscfs/procfs/procfs_vnops.c 8 Jul 2014 17:19:25 -0000 1.60
+++ sys/miscfs/procfs/procfs_vnops.c 19 Aug 2014 13:54:11 -0000
@@ -909,18 +909,24 @@ procfs_readdir(void *v)
/* fall through */
default:
- while (pcnt < i)
+ while (pcnt < i) {
pcnt++;
+ pr = LIST_NEXT(pr, ps_list);
+ if (pr == NULL)
+ goto done;
+ }
d.d_fileno = PROCFS_FILENO(pr->ps_pid, Pproc);
d.d_namlen = snprintf(d.d_name,
sizeof(d.d_name),
"%ld", (long)pr->ps_pid);
d.d_type = DT_REG;
+ pr = LIST_NEXT(pr, ps_list);
break;
}
if ((error = uiomove(&d, UIO_MX, uio)) != 0)
break;
}
+ done:
#ifdef PROCFS_ZOMBIE
if (pr == NULL && doingzomb == 0) {
doingzomb = 1;