yushuailong opened a new pull request, #20650:
URL: https://github.com/apache/nuttx/pull/20650

   ## Summary
   
   * Fix child exit-status accounting when a task is terminated by another task 
through `task_delete()`.
   * `nxtask_exithook()` runs in the deleting task's context for externally 
terminated tasks. The previous code used `nxsched_getpid()` to locate the 
child-status entry, which returned the deleting task's PID instead of the 
terminated child's PID.
   * As a result, the terminated child's status might not be recorded and 
`CHILD_FLAG_EXITED` might not be set. A subsequent `waitpid()` for that child 
could remain blocked. If the deleting task was also a child of the same parent, 
the wrong child-status entry could be updated.
   * Pass the terminated task's `ctcb->pid` to the exit-status helper.
   * Use the child process-group PID only when marking the final exit of the 
complete task group, so pthread groups continue to use the main task PID while 
kernel-thread child records retain their actual task PID.
   
   ## Impact
   
   * Is new feature added? Is existing feature changed? **NO**. This fixes 
existing child exit-status handling.
   * Impact on user? **NO**. No application changes are required.
   * Impact on build? **NO**.
   * Impact on hardware? **NO**. The change is scheduler code and is 
architecture independent.
   * Impact on documentation? **NO**.
   * Impact on security? **NO known direct security impact**.
   * Impact on compatibility? **NO**. Self-termination behavior is unchanged; 
the fix only affects status accounting when another task terminates a child.
   * Runtime impact: `waitpid()` can correctly observe a child terminated by 
another task.
   
   ## Testing
   
   Build host: macOS 26.6.2 ARM64, Apple Clang 21.0.0.
   Target: sim:ostest.
   Build: make completes successfully with LD: nuttx.
   Static checks: nxstyle, checkpatch pass.
   Runtime smoke test: ./nuttx starts and proceeds through enabled OSTest cases 
without an assertion in the observed run.
   
   


-- 
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]

Reply via email to