Skip to content

uloop: report signal termination in process callbacks - #439

Merged
jow- merged 1 commit into
jow-:masterfrom
st7105:fix/uloop-process-signal-status
Sep 14, 2026
Merged

jow- merged 1 commit into
jow-:masterfrom
st7105:fix/uloop-process-signal-status

Conversation

@st7105

@st7105 st7105 commented Sep 14, 2026

Copy link
Copy Markdown
Contributor

uloop.process() currently reports a zero exit code when a child is
terminated by a signal: uc_uloop_process_cb() shifts the raw wait status
right 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() and fs.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:

Child termination Before After
exit 0 0 0
exit 7 7 7
exit 137 137 137
SIGTERM 0 -15
SIGKILL 0 -9

The 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.

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>
@jow-
jow- merged commit c710f59 into jow-:master Sep 14, 2026
2 checks passed
@jow-

jow- commented Sep 14, 2026

Copy link
Copy Markdown
Owner

Merged, thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants