You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@nuttx.apache.org by ac...@apache.org on 2026/10/18 20:52:43 UTC
(nuttx-apps) branch master updated (d623c9fef -> a3dd498f9)
This is an automated email from the ASF dual-hosted git repository.
acassis pushed a change to branch master
in repository https://gitbox.apache.org/repos/asf/nuttx-apps.git
from d623c9fef testing/drivers/taskwdt: add a test of the task watchdog supervisor.
new ad36e23b6 netutils/dhcp6c: Fix the nxstyle errors in dhcp6c.c.
new 794c134b4 examples/usrsocktest: Fix the nxstyle error in the wake test.
new 045160d3b system/nxinit: Install a handler for SIGCHLD.
new 2a0de9ac2 netutils/dhcpc: Use a handler for SIGQUIT in dhcpc_cancel().
new 534a7ac9a netutils/dhcp6c: Print the length of a received message with %zd.
new 9ec6728ef netutils/dhcp6c: Use a handler for SIGQUIT in dhcp6c_cancel().
new 62ccc756e netutils/ntpclient: Install a handler for the wake-up signal.
new 81b22625a netutils/ftpc: Install a handler for CONFIG_FTP_SIGNAL.
new a3dd498f9 examples/usrsocktest: Install a handler for SIGUSR1 in the wake test.
The 9 revisions listed above as "new" are entirely new to this
repository and will be described in separate emails. The revisions
listed as "add" were already present in the repository and have only
been added to this reference.
Summary of changes:
.../usrsocktest/usrsocktest_wake_with_signal.c | 25 ++++++++++++-
netutils/dhcp6c/dhcp6c.c | 42 +++++++++++++++++-----
netutils/dhcpc/dhcpc.c | 18 +++++++++-
netutils/ftpc/ftpc_connect.c | 33 +++++++++++++++++
netutils/ntpclient/ntpclient.c | 29 +++++++++++++++
system/nxinit/init.c | 21 +++++++++++
6 files changed, 158 insertions(+), 10 deletions(-)
(nuttx-apps) 03/09: system/nxinit: Install a handler for SIGCHLD.
Posted by ac...@apache.org.
This is an automated email from the ASF dual-hosted git repository.
acassis pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/nuttx-apps.git
commit 045160d3bbd6a8a81b0355a7c672dfa9b9fb4ac8
Author: Marco Casaroli <ma...@gmail.com>
AuthorDate: Sun Oct 18 12:57:32 2026 +0200
system/nxinit: Install a handler for SIGCHLD.
init waits in ppoll() and expects SIGCHLD to interrupt it when a child
exits, but it installed no handler for SIGCHLD. An ignored signal need
not interrupt ppoll(), and with CONFIG_SIG_DISCARD_IGNORED it does not:
init then never sees that a command of init.rc has finished.
Install an empty handler for SIGCHLD.
Assisted-by: Claude Code:claude-opus-5-5
Signed-off-by: Marco Casaroli <ma...@gmail.com>
---
system/nxinit/init.c | 21 +++++++++++++++++++++
1 file changed, 21 insertions(+)
diff --git a/system/nxinit/init.c b/system/nxinit/init.c
index cda3317d9..d0329a114 100644
--- a/system/nxinit/init.c
+++ b/system/nxinit/init.c
@@ -31,6 +31,7 @@
#include <poll.h>
#include <sched.h>
#include <stdio.h>
+#include <signal.h>
#include <string.h>
#include <sys/boardctl.h>
#include <sys/param.h>
@@ -58,6 +59,16 @@
* Private Functions
****************************************************************************/
+/* An empty handler: SIGCHLD must interrupt ppoll() when a child exits. A
+ * signal without a handler is ignored and need not interrupt it.
+ */
+
+#ifdef CONFIG_ENABLE_ALL_SIGNALS
+static void init_sigchld(int signo)
+{
+}
+#endif
+
static void reap_process(FAR struct service_manager_s *sm,
FAR struct action_manager_s *am)
{
@@ -224,6 +235,9 @@ int main(int argc, FAR char *argv[])
};
struct pollfd pfds[nitems(poller)];
+#ifdef CONFIG_ENABLE_ALL_SIGNALS
+ struct sigaction sa;
+#endif
sigset_t mask;
size_t i;
int r;
@@ -233,6 +247,13 @@ int main(int argc, FAR char *argv[])
ACTION_PROP_KEY_TRIGGER ".core%d", sched_getcpu());
#endif
+#ifdef CONFIG_ENABLE_ALL_SIGNALS
+ memset(&sa, 0, sizeof(sa));
+ sa.sa_handler = init_sigchld;
+ sigemptyset(&sa.sa_mask);
+ sigaction(SIGCHLD, &sa, NULL);
+#endif
+
sigfillset(&mask);
r = sigprocmask(SIG_BLOCK, &mask, &am.sigmask);
sigemptyset(&mask);
(nuttx-apps) 05/09: netutils/dhcp6c: Print the length of a received message with %zd.
Posted by ac...@apache.org.
This is an automated email from the ASF dual-hosted git repository.
acassis pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/nuttx-apps.git
commit 534a7ac9afc80e152527c327de1fe211d30fc0a7
Author: Marco Casaroli <ma...@gmail.com>
AuthorDate: Sun Oct 18 13:44:15 2026 +0200
netutils/dhcp6c: Print the length of a received message with %zd.
dhcp6c_command() printed the ssize_t result of recv() with %d. On a
64-bit target the build fails with -Werror=format.
Use %zd.
Assisted-by: Claude Code:claude-opus-5-5
Signed-off-by: Marco Casaroli <ma...@gmail.com>
---
netutils/dhcp6c/dhcp6c.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/netutils/dhcp6c/dhcp6c.c b/netutils/dhcp6c/dhcp6c.c
index dd89b931c..931d484b3 100644
--- a/netutils/dhcp6c/dhcp6c.c
+++ b/netutils/dhcp6c/dhcp6c.c
@@ -865,7 +865,7 @@ static int dhcp6c_command(FAR void *handle, enum dhcpv6_msg_e type)
len = recv(pdhcp6c->sockfd, buf, buf_length, 0);
if (type != DHCPV6_MSG_UNKNOWN)
{
- ninfo("%s[type:%d] recv len[%d]\n", __func__, type, len);
+ ninfo("%s[type:%d] recv len[%zd]\n", __func__, type, len);
}
if (!dhcp6c_response_is_valid(handle, buf, len, trid, type))
(nuttx-apps) 09/09: examples/usrsocktest: Install a handler for SIGUSR1 in the wake test.
Posted by ac...@apache.org.
This is an automated email from the ASF dual-hosted git repository.
acassis pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/nuttx-apps.git
commit a3dd498f9f576057b00956e08dcfc2c0a2090e9f
Author: Marco Casaroli <ma...@gmail.com>
AuthorDate: Sun Oct 18 12:58:53 2026 +0200
examples/usrsocktest: Install a handler for SIGUSR1 in the wake test.
The wake test sends SIGUSR1 to its threads to break them out of blocking
socket calls, but it installed no handler for SIGUSR1. An ignored signal
need not interrupt the calls, and with CONFIG_SIG_DISCARD_IGNORED it does
not.
Install an empty handler before the threads start.
Assisted-by: Claude Code:claude-opus-5-5
Signed-off-by: Marco Casaroli <ma...@gmail.com>
---
.../usrsocktest/usrsocktest_wake_with_signal.c | 22 ++++++++++++++++++++++
1 file changed, 22 insertions(+)
diff --git a/examples/usrsocktest/usrsocktest_wake_with_signal.c b/examples/usrsocktest/usrsocktest_wake_with_signal.c
index 068e054e0..d8b091e68 100644
--- a/examples/usrsocktest/usrsocktest_wake_with_signal.c
+++ b/examples/usrsocktest/usrsocktest_wake_with_signal.c
@@ -24,6 +24,8 @@
* Included Files
****************************************************************************/
+#include <signal.h>
+#include <string.h>
#include <sys/socket.h>
#include <assert.h>
#include <netinet/in.h>
@@ -575,6 +577,12 @@ static FAR void *usrsock_blocking_poll_thread(FAR void *param)
return NULL;
}
+#ifdef CONFIG_ENABLE_ALL_SIGNALS
+static void wake_signal(int signo)
+{
+}
+#endif
+
static void do_wake_test(enum e_test_type type, int flags)
{
int ret;
@@ -582,6 +590,9 @@ static void do_wake_test(enum e_test_type type, int flags)
int tidx;
bool test_abort = !!(flags & TEST_FLAG_DAEMON_ABORT);
bool test_hang = !!(flags & TEST_FLAG_PAUSE_USRSOCK_HANDLING);
+#ifdef CONFIG_ENABLE_ALL_SIGNALS
+ struct sigaction sa;
+#endif
/* Start test daemon. */
@@ -589,6 +600,17 @@ static void do_wake_test(enum e_test_type type, int flags)
usrsocktest_daemon_start(&usrsocktest_daemon_config));
TEST_ASSERT_EQUAL(0, usrsocktest_daemon_get_num_active_sockets());
+#ifdef CONFIG_ENABLE_ALL_SIGNALS
+ /* The test wakes the threads with SIGUSR1: install a handler, because an
+ * ignored signal need not interrupt a blocking call.
+ */
+
+ memset(&sa, 0, sizeof(sa));
+ sa.sa_handler = wake_signal;
+ sigemptyset(&sa.sa_mask);
+ sigaction(SIGUSR1, &sa, NULL);
+#endif
+
/* Launch worker threads. */
test_type = type;
(nuttx-apps) 04/09: netutils/dhcpc: Use a handler for SIGQUIT in dhcpc_cancel().
Posted by ac...@apache.org.
This is an automated email from the ASF dual-hosted git repository.
acassis pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/nuttx-apps.git
commit 2a0de9ac2d4933a4cd6d10b7e4705467f6e2a2e8
Author: Marco Casaroli <ma...@gmail.com>
AuthorDate: Sun Oct 18 12:58:01 2026 +0200
netutils/dhcpc: Use a handler for SIGQUIT in dhcpc_cancel().
dhcpc_cancel() set SIGQUIT to SIG_IGN and sent it to the thread of
dhcpc_run() to break it out of a blocking call. An ignored signal need
not interrupt that call, and with CONFIG_SIG_DISCARD_IGNORED it does not.
Set an empty handler instead of SIG_IGN. The handler also keeps SIGQUIT
from terminating the process, as SIG_IGN did.
Assisted-by: Claude Code:claude-opus-5-5
Signed-off-by: Marco Casaroli <ma...@gmail.com>
---
netutils/dhcpc/dhcpc.c | 18 +++++++++++++++++-
1 file changed, 17 insertions(+), 1 deletion(-)
diff --git a/netutils/dhcpc/dhcpc.c b/netutils/dhcpc/dhcpc.c
index 281a96ebd..c882e213d 100644
--- a/netutils/dhcpc/dhcpc.c
+++ b/netutils/dhcpc/dhcpc.c
@@ -45,6 +45,7 @@
#include <inttypes.h>
#include <stdlib.h>
#include <stdint.h>
+#include <signal.h>
#include <string.h>
#include <unistd.h>
#include <errno.h>
@@ -157,6 +158,21 @@ static const uint8_t magic_cookie[4] =
* Private Functions
****************************************************************************/
+#ifdef CONFIG_ENABLE_ALL_SIGNALS
+/****************************************************************************
+ * Name: dhcpc_wakeup
+ *
+ * Description:
+ * An empty handler for SIGQUIT. dhcpc_cancel() sends SIGQUIT to break
+ * dhcpc_run() out of recv(); an ignored signal need not interrupt recv().
+ *
+ ****************************************************************************/
+
+static void dhcpc_wakeup(int signo)
+{
+}
+#endif
+
/****************************************************************************
* Name: dhcpc_add<option>
****************************************************************************/
@@ -757,7 +773,7 @@ void dhcpc_cancel(FAR void *handle)
if (pdhcpc->thread)
{
#ifdef CONFIG_ENABLE_ALL_SIGNALS
- old = signal(SIGQUIT, SIG_IGN);
+ old = signal(SIGQUIT, dhcpc_wakeup);
/* Signal the dhcpc_run */
(nuttx-apps) 02/09: examples/usrsocktest: Fix the nxstyle error in the wake test.
Posted by ac...@apache.org.
This is an automated email from the ASF dual-hosted git repository.
acassis pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/nuttx-apps.git
commit 794c134b49248204b122e2c3028cea6237de9af3
Author: Marco Casaroli <ma...@gmail.com>
AuthorDate: Sun Oct 18 12:59:48 2026 +0200
examples/usrsocktest: Fix the nxstyle error in the wake test.
nxstyle reports "Left bracket not on separate line" for an initializer
in usrsocktest_wake_with_signal.c.
Move the bracket to its own line. This commit changes only whitespace.
Assisted-by: Claude Code:claude-opus-5-5
Signed-off-by: Marco Casaroli <ma...@gmail.com>
---
examples/usrsocktest/usrsocktest_wake_with_signal.c | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
diff --git a/examples/usrsocktest/usrsocktest_wake_with_signal.c b/examples/usrsocktest/usrsocktest_wake_with_signal.c
index da460ab15..068e054e0 100644
--- a/examples/usrsocktest/usrsocktest_wake_with_signal.c
+++ b/examples/usrsocktest/usrsocktest_wake_with_signal.c
@@ -508,7 +508,8 @@ static void do_usrsock_blocking_poll_thread(FAR void *param)
intptr_t tidx = (intptr_t)param;
struct sockaddr_in addr;
int ret;
- struct pollfd pfd = {
+ struct pollfd pfd =
+ {
};
bool test_abort = !!(test_flags & TEST_FLAG_DAEMON_ABORT);
(nuttx-apps) 01/09: netutils/dhcp6c: Fix the nxstyle errors in dhcp6c.c.
Posted by ac...@apache.org.
This is an automated email from the ASF dual-hosted git repository.
acassis pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/nuttx-apps.git
commit ad36e23b6ed68a273197dec05c1fe00c56b0d8d6
Author: Marco Casaroli <ma...@gmail.com>
AuthorDate: Sun Oct 18 12:59:48 2026 +0200
netutils/dhcp6c: Fix the nxstyle errors in dhcp6c.c.
nxstyle reports 13 errors in dhcp6c.c: a block with bad alignment,
missing blank lines after declarations, and an if/else without braces.
Fix them. This commit changes only whitespace and adds the braces.
Assisted-by: Claude Code:claude-opus-5-5
Signed-off-by: Marco Casaroli <ma...@gmail.com>
---
netutils/dhcp6c/dhcp6c.c | 24 ++++++++++++++++++------
1 file changed, 18 insertions(+), 6 deletions(-)
diff --git a/netutils/dhcp6c/dhcp6c.c b/netutils/dhcp6c/dhcp6c.c
index 3989bee0c..dd89b931c 100644
--- a/netutils/dhcp6c/dhcp6c.c
+++ b/netutils/dhcp6c/dhcp6c.c
@@ -366,11 +366,11 @@ static bool dhcp6c_commit_state(FAR void *handle, enum dhcpv6_state_e state,
if (new_len != 0 || old_len != 0)
{
- upd = (new_len != old_len) ||
- (memcmp(old_data, new_data, new_len) != 0);
+ upd = (new_len != old_len) ||
+ (memcmp(old_data, new_data, new_len) != 0);
- memmove(old_data, new_data, new_len);
- dhcp6c_resize_state(handle, state, -old_len);
+ memmove(old_data, new_data, new_len);
+ dhcp6c_resize_state(handle, state, -old_len);
}
return upd;
@@ -768,6 +768,7 @@ static int dhcp6c_command(FAR void *handle, enum dhcpv6_msg_e type)
if (retx->delay)
{
struct timespec ts;
+
ts.tv_sec = 0;
ts.tv_nsec = dhcp6c_rand_delay(handle, 10 * DHCPV6_REQ_DELAY);
nanosleep(&ts, NULL);
@@ -904,6 +905,7 @@ end:
static int dhcp6c_poll_reconfigure(FAR void *handle)
{
int ret = dhcp6c_command(handle, DHCPV6_MSG_UNKNOWN);
+
if (ret != -1)
{
ret = dhcp6c_command(handle, ret);
@@ -1194,6 +1196,7 @@ static int dhcp6c_handle_reply(FAR void *handle, enum dhcpv6_msg_e orig,
FAR uint8_t *ia_na = dhcp6c_get_state(handle, STATE_IA_NA, &ia_na_len);
FAR uint8_t *ia_pd = dhcp6c_get_state(handle, STATE_IA_PD, &ia_pd_len);
FAR uint8_t *ia_end;
+
pdhcp6c->t1 = UINT32_MAX;
pdhcp6c->t2 = UINT32_MAX;
pdhcp6c->t3 = UINT32_MAX;
@@ -1363,6 +1366,7 @@ static int dhcp6c_handle_reply(FAR void *handle, enum dhcpv6_msg_e orig,
else if (otype == DHCPV6_OPT_INFO_REFRESH && olen >= 4)
{
uint32_t refresh = ntohl(*((FAR uint32_t *)odata));
+
if (refresh < (uint32_t)pdhcp6c->t1)
{
pdhcp6c->t1 = refresh;
@@ -1378,6 +1382,7 @@ static int dhcp6c_handle_reply(FAR void *handle, enum dhcpv6_msg_e orig,
{
size_t new_ia_pd_len;
size_t new_ia_na_len;
+
have_update |= dhcp6c_commit_state(handle, STATE_DNS, dns_len);
have_update |= dhcp6c_commit_state(handle, STATE_SEARCH, search_len);
have_update |= dhcp6c_commit_state(handle, STATE_SNTP_IP,
@@ -1400,6 +1405,7 @@ static int dhcp6c_handle_reply(FAR void *handle, enum dhcpv6_msg_e orig,
dhcpv6_for_each_option(ite0, ia_pd, ia_end, otype, olen, odata)
{
FAR struct dhcpv6_ia_prefix_s *p = (FAR void *)(odata - 4);
+
while (!p->valid)
{
ia_end = ia_pd + dhcp6c_remove_state(handle, STATE_IA_PD,
@@ -1415,6 +1421,7 @@ static int dhcp6c_handle_reply(FAR void *handle, enum dhcpv6_msg_e orig,
dhcpv6_for_each_option(ite0, ia_na, ia_end, otype, olen, odata)
{
FAR struct dhcpv6_ia_addr_s *p = (FAR void *)(odata - 4);
+
while (!p->valid)
{
ia_end = ia_na + dhcp6c_remove_state(handle, STATE_IA_NA,
@@ -1605,9 +1612,13 @@ static int dhcp6c_lease(FAR void *args, uint8_t type)
/* If we have any IAs, send renew, otherwise request */
if (ia_pd_len == 0 && ia_na_len == 0)
- ret = dhcp6c_command(pdhcp6c, DHCPV6_MSG_REQUEST);
+ {
+ ret = dhcp6c_command(pdhcp6c, DHCPV6_MSG_REQUEST);
+ }
else
- ret = dhcp6c_command(pdhcp6c, DHCPV6_MSG_RENEW);
+ {
+ ret = dhcp6c_command(pdhcp6c, DHCPV6_MSG_RENEW);
+ }
if (pdhcp6c->cancel)
{
@@ -1831,6 +1842,7 @@ static FAR void *dhcp6c_precise_open(FAR const char *ifname,
if (opt != NULL && cnt > 0)
{
uint16_t opttype;
+
for (int i = 0; i < cnt; i++)
{
opttype = htons(opt[i]);
(nuttx-apps) 07/09: netutils/ntpclient: Install a handler for the wake-up signal.
Posted by ac...@apache.org.
This is an automated email from the ASF dual-hosted git repository.
acassis pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/nuttx-apps.git
commit 62ccc756e4ffdb1a9081c60d7f68443df53dd0a0
Author: Marco Casaroli <ma...@gmail.com>
AuthorDate: Sun Oct 18 12:58:35 2026 +0200
netutils/ntpclient: Install a handler for the wake-up signal.
ntpc_stop() sends CONFIG_NETUTILS_NTPCLIENT_SIGWAKEUP to break the
daemon out of a blocking call, but the daemon installed no handler for
it. An ignored signal need not interrupt the call, and with
CONFIG_SIG_DISCARD_IGNORED it does not.
Install an empty handler when the daemon starts.
Assisted-by: Claude Code:claude-opus-5-5
Signed-off-by: Marco Casaroli <ma...@gmail.com>
---
netutils/ntpclient/ntpclient.c | 29 +++++++++++++++++++++++++++++
1 file changed, 29 insertions(+)
diff --git a/netutils/ntpclient/ntpclient.c b/netutils/ntpclient/ntpclient.c
index b75f8126a..08f26c515 100644
--- a/netutils/ntpclient/ntpclient.c
+++ b/netutils/ntpclient/ntpclient.c
@@ -35,6 +35,7 @@
#include <stdio.h>
#include <stdlib.h>
+#include <signal.h>
#include <string.h>
#include <time.h>
#include <sched.h>
@@ -1368,6 +1369,22 @@ sock_error:
return ERROR;
}
+#ifdef CONFIG_ENABLE_ALL_SIGNALS
+/****************************************************************************
+ * Name: ntpc_wakeup
+ *
+ * Description:
+ * An empty handler for CONFIG_NETUTILS_NTPCLIENT_SIGWAKEUP. ntpc_stop()
+ * sends the signal to break the daemon out of a blocking call; an ignored
+ * signal need not interrupt it.
+ *
+ ****************************************************************************/
+
+static void ntpc_wakeup(int signo)
+{
+}
+#endif
+
/****************************************************************************
* Name: ntpc_daemon
*
@@ -1382,6 +1399,9 @@ static int ntpc_daemon(int argc, FAR char **argv)
{
FAR struct ntp_sample_s *samples;
FAR struct ntp_servers_s *srvs;
+#ifdef CONFIG_ENABLE_ALL_SIGNALS
+ struct sigaction sa;
+#endif
int exitcode = EXIT_SUCCESS;
int retries = 0;
int retry_delay = 1;
@@ -1406,6 +1426,15 @@ static int ntpc_daemon(int argc, FAR char **argv)
return EXIT_FAILURE;
}
+#ifdef CONFIG_ENABLE_ALL_SIGNALS
+ /* ntpc_stop() wakes the daemon with a signal: install a handler */
+
+ memset(&sa, 0, sizeof(sa));
+ sa.sa_handler = ntpc_wakeup;
+ sigemptyset(&sa.sa_mask);
+ sigaction(CONFIG_NETUTILS_NTPCLIENT_SIGWAKEUP, &sa, NULL);
+#endif
+
/* Indicate that we have started */
g_ntpc_daemon.state = NTP_RUNNING;
(nuttx-apps) 08/09: netutils/ftpc: Install a handler for CONFIG_FTP_SIGNAL.
Posted by ac...@apache.org.
This is an automated email from the ASF dual-hosted git repository.
acassis pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/nuttx-apps.git
commit 81b22625ad62e4dc5a8b0b6a50535b7ce2c1d767
Author: Marco Casaroli <ma...@gmail.com>
AuthorDate: Sun Oct 18 12:58:35 2026 +0200
netutils/ftpc: Install a handler for CONFIG_FTP_SIGNAL.
ftpc_timeout() sends CONFIG_FTP_SIGNAL to break the session task out of
a blocking call, but nothing installed a handler for it. An ignored
signal need not interrupt the call, and with CONFIG_SIG_DISCARD_IGNORED
it does not.
Install an empty handler in ftpc_connect().
Assisted-by: Claude Code:claude-opus-5-5
Signed-off-by: Marco Casaroli <ma...@gmail.com>
---
netutils/ftpc/ftpc_connect.c | 33 +++++++++++++++++++++++++++++++++
1 file changed, 33 insertions(+)
diff --git a/netutils/ftpc/ftpc_connect.c b/netutils/ftpc/ftpc_connect.c
index f28c40b61..06f3c03be 100644
--- a/netutils/ftpc/ftpc_connect.c
+++ b/netutils/ftpc/ftpc_connect.c
@@ -28,6 +28,7 @@
#include <stdlib.h>
#include <unistd.h>
+#include <signal.h>
#include <string.h>
#include <errno.h>
#include <nuttx/debug.h>
@@ -38,6 +39,24 @@
#include "ftpc_internal.h"
+/****************************************************************************
+ * Private Functions
+ ****************************************************************************/
+
+#ifdef CONFIG_ENABLE_ALL_SIGNALS
+/****************************************************************************
+ * Name: ftpc_wakeup
+ *
+ * Description:
+ * An empty handler for CONFIG_FTP_SIGNAL.
+ *
+ ****************************************************************************/
+
+static void ftpc_wakeup(int signo)
+{
+}
+#endif
+
/****************************************************************************
* Public Functions
****************************************************************************/
@@ -53,6 +72,9 @@
SESSION ftpc_connect(FAR union ftpc_sockaddr_u *server)
{
FAR struct ftpc_session_s *session;
+#ifdef CONFIG_ENABLE_ALL_SIGNALS
+ struct sigaction sa;
+#endif
int ret;
/* Allocate a session structure */
@@ -75,6 +97,17 @@ SESSION ftpc_connect(FAR union ftpc_sockaddr_u *server)
session->conntimeo = CONFIG_FTP_DEFTIMEO * CLOCKS_PER_SEC;
session->pid = getpid();
+ /* ftpc_timeout() wakes this task with CONFIG_FTP_SIGNAL: install a
+ * handler, because an ignored signal need not interrupt a blocking call.
+ */
+
+#ifdef CONFIG_ENABLE_ALL_SIGNALS
+ memset(&sa, 0, sizeof(sa));
+ sa.sa_handler = ftpc_wakeup;
+ sigemptyset(&sa.sa_mask);
+ sigaction(CONFIG_FTP_SIGNAL, &sa, NULL);
+#endif
+
session->cmd.sd = -1;
session->data.sd = -1;
session->dacceptor.sd = -1;
(nuttx-apps) 06/09: netutils/dhcp6c: Use a handler for SIGQUIT in dhcp6c_cancel().
Posted by ac...@apache.org.
This is an automated email from the ASF dual-hosted git repository.
acassis pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/nuttx-apps.git
commit 9ec6728ef8d54ab62fb5952df7502bcb60a74823
Author: Marco Casaroli <ma...@gmail.com>
AuthorDate: Sun Oct 18 12:58:02 2026 +0200
netutils/dhcp6c: Use a handler for SIGQUIT in dhcp6c_cancel().
dhcp6c_cancel() set SIGQUIT to SIG_IGN and sent it to the thread of
dhcp6c_run() to break it out of a blocking call. An ignored signal need
not interrupt that call, and with CONFIG_SIG_DISCARD_IGNORED it does not.
Set an empty handler instead of SIG_IGN. The handler also keeps SIGQUIT
from terminating the process, as SIG_IGN did.
Assisted-by: Claude Code:claude-opus-5-5
Signed-off-by: Marco Casaroli <ma...@gmail.com>
---
netutils/dhcp6c/dhcp6c.c | 16 +++++++++++++++-
1 file changed, 15 insertions(+), 1 deletion(-)
diff --git a/netutils/dhcp6c/dhcp6c.c b/netutils/dhcp6c/dhcp6c.c
index 931d484b3..5505f11b3 100644
--- a/netutils/dhcp6c/dhcp6c.c
+++ b/netutils/dhcp6c/dhcp6c.c
@@ -287,6 +287,20 @@ static const struct dhcp6c_retx_s g_dhcp6c_retx[DHCPV6_MSG_MAX] =
* Private Functions
****************************************************************************/
+/****************************************************************************
+ * Name: dhcp6c_wakeup
+ *
+ * Description:
+ * An empty handler for SIGQUIT. dhcp6c_cancel() sends SIGQUIT to break
+ * dhcp6c_run() out of a blocking call; an ignored signal need not
+ * interrupt it.
+ *
+ ****************************************************************************/
+
+static void dhcp6c_wakeup(int signo)
+{
+}
+
static uint64_t dhcp6c_get_milli_time(void)
{
struct timespec t;
@@ -1921,7 +1935,7 @@ void dhcp6c_cancel(FAR void *handle)
pdhcp6c->cancel = true;
if (pdhcp6c->thread)
{
- old = signal(SIGQUIT, SIG_IGN);
+ old = signal(SIGQUIT, dhcp6c_wakeup);
/* Signal the dhcp6c_run */