casaroli opened a new pull request, #20783: URL: https://github.com/apache/nuttx/pull/20783
## Summary `nxsig_tcbdispatch()` woke a task in `TSTATE_WAIT_SIG` for any unmasked signal, also for one that is ignored. So `nanosleep()`, `pause()` and `sigsuspend()` ended early when a child of the task exited (`SIGCHLD`). POSIX discards an ignored signal: it does not end these functions. This PR wakes a task that waits for signals with an ignored signal only when the signal is in its wait set, as for `sigwaitinfo()` and `sigtimedwait()`. It is a follow-up of apache/nuttx#20766, which discards ignored signals for semaphore and message queue waits. depends-on: [apache/nuttx/pull/20766 apache/nuttx-apps/pull/3868] ## Impact `nanosleep()`, `pause()` and `sigsuspend()` are no longer ended by a signal that has no action. `sigwaitinfo()` and `sigtimedwait()` still return the signals they wait for. Kernel threads are not affected. ## Testing A test program on `qemu-armv8a:knsh` (QEMU 11 with HVF on an Apple M4). A child exits after 200 ms, so an ignored `SIGCHLD` arrives while the parent waits; `SIGALRM` with a handler ends the waits after 1 s: | Check | apache/nuttx#20766 only | this PR | |---|---|---| | `nanosleep()` of 1 s | ends after 201 ms | returns 0 after 1001 ms | | `pause()` | ends after 201 ms (by `SIGCHLD`) | ends after 1001 ms by `SIGALRM` | | `sigsuspend()` | ends after 201 ms (by `SIGCHLD`) | ends after 1001 ms by `SIGALRM` | | `sigtimedwait()` for a blocked `SIGCHLD` | returns it after 201 ms | returns it after 201 ms | `ostest` on `qemu-armv8a:knsh` and `qemu-armv8a:nsh` ends with `ostest_main: Exiting with status 0`. `tools/checkpatch.sh -c -u -m -g` passes. -- 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]
