You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@nuttx.apache.org by "patacongo (via GitHub)" <gi...@apache.org> on 2023/08/10 15:19:06 UTC

[GitHub] [nuttx] patacongo commented on issue #10159: Wait after vfork get errno ECHILD

patacongo commented on issue #10159:
URL: https://github.com/apache/nuttx/issues/10159#issuecomment-1673433321

   The logic seems bad.  wait() just calls waitpid() with an invalid PID:
   
        67 pid_t wait(FAR int *stat_loc)
        68 {
        69   /* wait() is a cancellation point, but nothings needs to be done for this
        70    * trivial case.
        71    */
        72
        73   return waitpid(INVALID_PROCESS_ID, stat_loc, 0);
        74 }
   
   But waitpid() return -ECHILD if the pid is not valid:
   
       114   ctcb = nxsched_get_tcb(pid);
       115   if (ctcb == NULL)
       116     {
       117       ret = -ECHILD;
       118       goto errout;
       119     }
   
   This logic appears in two places and there are several other cases where -ECHILD is returned.  But if the PID is invalid, I don't think you can get to those other cases.  Has this logic changed recently?


-- 
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: commits-unsubscribe@nuttx.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org