casaroli commented on code in PR #22524:
URL: https://github.com/apache/nuttx/pull/22524#discussion_r4731499428
##########
fs/procfs/fs_procfs.c:
##########
@@ -934,11 +935,14 @@ static int procfs_readdir(FAR struct inode *mountpt,
#ifndef CONFIG_FS_PROCFS_EXCLUDE_PROCESS
/* Skip the tasks of the snapshot of opendir() that have ended since:
- * the walk goes on with the next one, as on Linux.
+ * the walk goes on with the next one, as on Linux. A task has ended
+ * when kill() does not find it (nxsig_kill_target()): its TCB can
+ * stay in the table after its parent has waited for it.
*/
while (priv->index < priv->nentries &&
- nxsched_get_tcb(level0->pid[priv->index]) == NULL)
+ (nxsched_get_tcb(level0->pid[priv->index]) == NULL ||
Review Comment:
`<= 0` would also hide a thread that is in its exit and still has its TCB:
kill() still finds it, and proc_open() and proc_stat() still show it. Only a
zombie without a TCB has to be skipped: there is nothing to show for it.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]