uloop: report signal termination in process callbacks - #439
Merged
Merged
Conversation
The process callback currently obtains an exit code by shifting the wait status right by eight bits. A child terminated by a signal consequently appears to have exited successfully. Use the wait status macros to distinguish normal exits from signal termination. Preserve normal exit codes and return a negative signal number for signalled children, matching system() and fs.proc.close(). Document the callback result and add regression coverage for normal exits and SIGTERM/SIGKILL termination. Compare the callback results with system() so the test does not depend on numeric signal assignments. Cross-built baseline and fixed versions of upstream master and tested on OpenWrt x86_64 in QEMU. The baseline reports zero for both signals; the fixed version reports -15 and -9. All 194 available custom tests pass with the fixed build; the optional FFI suite was not built. Signed-off-by: st7105 <st7105@gmail.com>
Owner
|
Merged, thanks! |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
uloop.process()currently reports a zero exit code when a child isterminated by a signal:
uc_uloop_process_cb()shifts the raw wait statusright by eight bits without checking how the child terminated.
This change preserves ordinary exit codes and returns negative signal
numbers for signal termination, following
system()andfs.proc.close().It also documents the callback result and adds a custom regression test
which compares it with
system().Validation against upstream
5ee546ceccd50e1d0f0f882abf29e4e9c7a09e7d,cross-built with GCC 14.3.0 and run on OpenWrt x86_64/musl in QEMU:
exit 0exit 7exit 137The fixed build passes all 194 available custom tests, including the new
uloop test and the existing system() tests. The optional FFI module/suite
was not built; these were not Valgrind runs.
No process API expansion or package release changes are included.