signals: fix build and runtime issues when signals all isabled

Fix build and runtime issues when signals all disabled.

Signed-off-by: Chengdong Wang <wangchengdong@lixiang.com>
This commit is contained in:
wangchengdong 2026-01-16 22:47:13 +08:00 committed by Donny(董九柱)
parent 9c85568c4f
commit d9afe2db8c
19 changed files with 172 additions and 48 deletions

View file

@ -6,7 +6,7 @@
config EXAMPLES_CHRONO
tristate "Chronometer example to use with STM32LDiscover"
default n
depends on SLCD
depends on SLCD && ENABLE_ALL_SIGNALS
---help---
Enable the Chronometer example

View file

@ -6,7 +6,7 @@
config EXAMPLES_DJOYSTICK
tristate "Discrete joystick example"
default n
depends on INPUT_DJOYSTICK
depends on INPUT_DJOYSTICK && ENABLE_ALL_SIGNALS
---help---
Enable the discrete joystick example

View file

@ -6,6 +6,6 @@
config EXAMPLES_I2SLOOP
tristate "I2S loopback test"
default n
depends on I2S && AUDIO && DRIVERS_AUDIO && AUDIO_I2SCHAR
depends on I2S && AUDIO && DRIVERS_AUDIO && AUDIO_I2SCHAR && ENABLE_ALL_SIGNALS
---help---
Enable the I2S loopback test

View file

@ -542,8 +542,16 @@ static FAR void *ipfwd_receiver(FAR void *arg)
int errcode;
int i;
#ifdef CONFIG_DISABLE_ALL_SIGNALS
pthread_setcancelstate(PTHREAD_CANCEL_ENABLE, NULL);
pthread_setcanceltype(PTHREAD_CANCEL_DEFERRED, NULL);
#endif
for (i = 0; i < IPFWD_NPACKETS; i++)
{
#ifdef CONFIG_DISABLE_ALL_SIGNALS
pthread_testcancel();
#endif
nread = read(fwd->ia_fd, fwd->ia_buffer, IPFWD_BUFSIZE);
if (nread < 0)
{
@ -840,7 +848,12 @@ errout_with_receiver:
/* Wait for receiver thread to terminate */
#ifdef CONFIG_DISABLE_ALL_SIGNALS
pthread_cancel(fwd.if_receiver);
#else
pthread_kill(fwd.if_receiver, 9);
#endif
ret = pthread_join(fwd.if_receiver, &value);
if (ret != OK)
{

View file

@ -6,7 +6,7 @@
config EXAMPLES_ONESHOT
tristate "Oneshot timer example"
default n
depends on ONESHOT
depends on ONESHOT && ENABLE_ALL_SIGNALS
---help---
Enable the oneshot timer driver example

View file

@ -5,7 +5,7 @@
menuconfig EXAMPLES_SHV_NXBOOT_UPDATER
bool "Silicon Heaven Firmware updates for NXBoot"
depends on NETUTILS_LIBSHVC
depends on NETUTILS_LIBSHVC && ENABLE_ALL_SIGNALS
default n
---help---
Enable the shv-nxboot-updater application.

View file

@ -146,11 +146,20 @@ static void do_usrsock_blocking_socket_thread(FAR void *param)
TEST_ASSERT_TRUE(test_hang);
TEST_ASSERT_TRUE(test_abort);
#ifdef CONFIG_DISABLE_ALL_SIGNALS
pthread_setcancelstate(PTHREAD_CANCEL_ENABLE, NULL);
pthread_setcanceltype(PTHREAD_CANCEL_DEFERRED, NULL);
#endif
/* Allow main thread to hang usrsock daemon at this point. */
sem_post(&tid_startsem);
sem_wait(&tid_releasesem);
#ifdef CONFIG_DISABLE_ALL_SIGNALS
pthread_testcancel();
#endif
/* Attempt hanging open socket. */
sem_post(&tid_startsem);
@ -176,6 +185,11 @@ static void do_usrsock_blocking_close_thread(FAR void *param)
TEST_ASSERT_TRUE(test_hang);
TEST_ASSERT_TRUE(test_abort);
#ifdef CONFIG_DISABLE_ALL_SIGNALS
pthread_setcancelstate(PTHREAD_CANCEL_ENABLE, NULL);
pthread_setcanceltype(PTHREAD_CANCEL_DEFERRED, NULL);
#endif
/* Open socket. */
test_sd[tidx] = socket(AF_INET, SOCK_STREAM, 0);
@ -190,6 +204,10 @@ static void do_usrsock_blocking_close_thread(FAR void *param)
sem_post(&tid_startsem);
sem_wait(&tid_releasesem);
#ifdef CONFIG_DISABLE_ALL_SIGNALS
pthread_testcancel();
#endif
/* Attempt hanging close socket. */
sem_post(&tid_startsem);
@ -214,6 +232,11 @@ static void do_usrsock_blocking_connect_thread(FAR void *param)
TEST_ASSERT_TRUE(test_hang || !test_hang);
#ifdef CONFIG_DISABLE_ALL_SIGNALS
pthread_setcancelstate(PTHREAD_CANCEL_ENABLE, NULL);
pthread_setcanceltype(PTHREAD_CANCEL_DEFERRED, NULL);
#endif
/* Open socket. */
test_sd[tidx] = socket(AF_INET, SOCK_STREAM, 0);
@ -228,6 +251,10 @@ static void do_usrsock_blocking_connect_thread(FAR void *param)
sem_post(&tid_startsem);
sem_wait(&tid_releasesem);
#ifdef CONFIG_DISABLE_ALL_SIGNALS
pthread_testcancel();
#endif
/* Attempt blocking connect. */
sem_post(&tid_startsem);
@ -257,6 +284,11 @@ static void do_usrsock_blocking_setsockopt_thread(FAR void *param)
bool test_abort = !!(test_flags & TEST_FLAG_DAEMON_ABORT);
bool test_hang = !!(test_flags & TEST_FLAG_PAUSE_USRSOCK_HANDLING);
#ifdef CONFIG_DISABLE_ALL_SIGNALS
pthread_setcancelstate(PTHREAD_CANCEL_ENABLE, NULL);
pthread_setcanceltype(PTHREAD_CANCEL_DEFERRED, NULL);
#endif
/* Open socket. */
test_sd[tidx] = socket(AF_INET, SOCK_STREAM, 0);
@ -274,6 +306,10 @@ static void do_usrsock_blocking_setsockopt_thread(FAR void *param)
sem_post(&tid_startsem);
sem_wait(&tid_releasesem);
#ifdef CONFIG_DISABLE_ALL_SIGNALS
pthread_testcancel();
#endif
/* Attempt hanging setsockopt. */
sem_post(&tid_startsem);
@ -304,6 +340,11 @@ static void do_usrsock_blocking_getsockopt_thread(FAR void *param)
bool test_abort = !!(test_flags & TEST_FLAG_DAEMON_ABORT);
bool test_hang = !!(test_flags & TEST_FLAG_PAUSE_USRSOCK_HANDLING);
#ifdef CONFIG_DISABLE_ALL_SIGNALS
pthread_setcancelstate(PTHREAD_CANCEL_ENABLE, NULL);
pthread_setcanceltype(PTHREAD_CANCEL_DEFERRED, NULL);
#endif
/* Open socket. */
test_sd[tidx] = socket(AF_INET, SOCK_STREAM, 0);
@ -321,6 +362,10 @@ static void do_usrsock_blocking_getsockopt_thread(FAR void *param)
sem_post(&tid_startsem);
sem_wait(&tid_releasesem);
#ifdef CONFIG_DISABLE_ALL_SIGNALS
pthread_testcancel();
#endif
/* Attempt hanging getsockopt. */
sem_post(&tid_startsem);
@ -352,6 +397,11 @@ static void do_usrsock_blocking_send_thread(FAR void *param)
TEST_ASSERT_TRUE(test_hang || !test_hang);
#ifdef CONFIG_DISABLE_ALL_SIGNALS
pthread_setcancelstate(PTHREAD_CANCEL_ENABLE, NULL);
pthread_setcanceltype(PTHREAD_CANCEL_DEFERRED, NULL);
#endif
/* Open socket. */
test_sd[tidx] = socket(AF_INET, SOCK_STREAM, 0);
@ -372,6 +422,10 @@ static void do_usrsock_blocking_send_thread(FAR void *param)
sem_post(&tid_startsem);
sem_wait(&tid_releasesem);
#ifdef CONFIG_DISABLE_ALL_SIGNALS
pthread_testcancel();
#endif
/* Attempt blocking send. */
sem_post(&tid_startsem);
@ -401,6 +455,11 @@ static void do_usrsock_blocking_recv_thread(FAR void *param)
TEST_ASSERT_TRUE(test_hang || !test_hang);
#ifdef CONFIG_DISABLE_ALL_SIGNALS
pthread_setcancelstate(PTHREAD_CANCEL_ENABLE, NULL);
pthread_setcanceltype(PTHREAD_CANCEL_DEFERRED, NULL);
#endif
/* Open socket. */
test_sd[tidx] = socket(AF_INET, SOCK_STREAM, 0);
@ -421,6 +480,10 @@ static void do_usrsock_blocking_recv_thread(FAR void *param)
sem_post(&tid_startsem);
sem_wait(&tid_releasesem);
#ifdef CONFIG_DISABLE_ALL_SIGNALS
pthread_testcancel();
#endif
/* Attempt blocking recv. */
sem_post(&tid_startsem);
@ -454,6 +517,11 @@ static void do_usrsock_blocking_poll_thread(FAR void *param)
TEST_ASSERT_TRUE(test_abort);
TEST_ASSERT_TRUE(test_hang || !test_hang);
#ifdef CONFIG_DISABLE_ALL_SIGNALS
pthread_setcancelstate(PTHREAD_CANCEL_ENABLE, NULL);
pthread_setcanceltype(PTHREAD_CANCEL_DEFERRED, NULL);
#endif
/* Open socket. */
test_sd[tidx] = socket(AF_INET, SOCK_STREAM, 0);
@ -474,6 +542,10 @@ static void do_usrsock_blocking_poll_thread(FAR void *param)
sem_post(&tid_startsem);
sem_wait(&tid_releasesem);
#ifdef CONFIG_DISABLE_ALL_SIGNALS
pthread_testcancel();
#endif
/* Attempt poll. */
pfd.fd = test_sd[tidx];
@ -560,8 +632,11 @@ static void do_wake_test(enum e_test_type type, int flags)
for (tidx = 0; tidx < nthreads; tidx++)
{
#ifdef CONFIG_DISABLE_ALL_SIGNALS
pthread_cancel(tid[tidx]);
#else
pthread_kill(tid[tidx], SIGUSR1);
#endif
/* Wait threads to complete work. */
ret = pthread_join(tid[tidx], NULL);

View file

@ -5,11 +5,11 @@
config EXAMPLES_XEDGE_DEMO
tristate "Xedge IoT Toolkit Demo"
depends on NETUTILS_XEDGE && ALLOW_GPL_COMPONENTS
depends on NETUTILS_XEDGE && ALLOW_GPL_COMPONENTS && ENABLE_ALL_SIGNALS
default n
---help---
Simple demonstration of the Xedge IoT Toolkit library.
This example shows how to integrate and use the Xedge library
in your NuttX application. Xedge provides a high-level development
environment for creating IoT and industrial device applications

View file

@ -6,7 +6,7 @@
config EXAMPLES_ZEROCROSS
tristate "Zero Cross Detection example"
default n
depends on SENSORS_ZEROCROSS
depends on SENSORS_ZEROCROSS && ENABLE_ALL_SIGNALS
---help---
Enable the zero cross detection example