casaroli opened a new pull request, #3868:
URL: https://github.com/apache/nuttx-apps/pull/3868

   ## Summary
   
   Some programs send a signal without a handler to break a task or thread out 
of a blocking call. POSIX does not promise that an ignored signal interrupts a 
function, and with `CONFIG_SIG_DISCARD_IGNORED` (apache/nuttx#20766) NuttX 
discards it, as POSIX allows.
   
   This PR installs an empty handler in each program that uses a signal this 
way, so that the signal interrupts the call with and without that option:
   
   - `system/nxinit`: `SIGCHLD`, which must interrupt `ppoll()` when a child 
exits. Without it, init never sees that a command of `init.rc` has finished.
   - `netutils/dhcpc` and `netutils/dhcp6c`: `SIGQUIT` in `dhcpc_cancel()` and 
`dhcp6c_cancel()`, which set it to `SIG_IGN` before. The handler also keeps 
`SIGQUIT` from terminating the process, as `SIG_IGN` did.
   - `netutils/ntpclient`: `CONFIG_NETUTILS_NTPCLIENT_SIGWAKEUP`, sent by 
`ntpc_stop()`.
   - `netutils/ftpc`: `CONFIG_FTP_SIGNAL`, sent by `ftpc_timeout()`.
   - `examples/usrsocktest`: `SIGUSR1` in the wake test.
   
   `netutils/mdns` is not changed: `mdnsd_stop()` sends 
`CONFIG_NETUTILS_MDNS_DAEMON_STOP_SIGNAL` to the downloaded `mdns` program, 
which has no handler for it.
   
   The first two commits only fix the old nxstyle errors in `dhcp6c.c` and 
`usrsocktest_wake_with_signal.c`. A third commit prints an `ssize_t` in 
`dhcp6c.c` with `%zd`: with `%d`, `dhcp6c.c` does not build on a 64-bit target.
   
   ## Impact
   
   Without `CONFIG_SIG_DISCARD_IGNORED`, nothing changes: the signals interrupt 
the calls as before. With it, these programs keep working.
   
   ## Testing
   
   `sim:citest` (x86_64 Linux, built and booted in a Debian container, as in 
CI):
   
   | nuttx | apps | Boot |
   |---|---|---|
   | apache/nuttx#20766, option off | master | reaches `nsh>` |
   | apache/nuttx#20766, `CONFIG_SIG_DISCARD_IGNORED=y` | master | stops after 
the `mount` of `init.rc`: init never sees that it finished |
   | apache/nuttx#20766, `CONFIG_SIG_DISCARD_IGNORED=y` | this PR | reaches 
`nsh>` |
   
   `sim:citest` builds `nxinit` and `usrsocktest`. `dhcpc`, `dhcp6c`, 
`ntpclient` and `ftpc` build on `qemu-armv8a:netnsh` with `CONFIG_NET_IPv6`, 
`CONFIG_NET_UDP_CHECKSUMS` and the four programs enabled, with 0 warnings.
   
   `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]

Reply via email to