Skip to content

Commit 8610764

Browse files
committed
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>
1 parent 60d814e commit 8610764

26 files changed

Lines changed: 181 additions & 37 deletions

File tree

canutils/candump/CMakeLists.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@
2020
#
2121
# ##############################################################################
2222

23-
if(CONFIG_CANUTILS_CANDUMP)
23+
if(CONFIG_CANUTILS_CANDUMP AND CONFIG_ENABLE_ALL_SIGNALS)
2424

2525
set(LIBCANUTILS_DIR ${NUTTX_APPS_DIR}/canutils/libcanutils)
2626

canutils/candump/Make.defs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,5 +21,7 @@
2121
############################################################################/
2222

2323
ifneq ($(CONFIG_CANUTILS_CANDUMP),)
24+
ifneq ($(CONFIG_ENABLE_ALL_SIGNALS),)
2425
CONFIGURED_APPS += $(APPDIR)/canutils/candump
2526
endif
27+
endif

examples/chrono/CMakeLists.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@
2020
#
2121
# ##############################################################################
2222

23-
if(CONFIG_EXAMPLES_CHRONO)
23+
if(CONFIG_EXAMPLES_CHRONO AND CONFIG_ENABLE_ALL_SIGNALS)
2424
nuttx_add_application(
2525
NAME
2626
${CONFIG_EXAMPLES_CHRONO_PROGNAME}

examples/chrono/Make.defs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,5 +21,7 @@
2121
############################################################################
2222

2323
ifneq ($(CONFIG_EXAMPLES_CHRONO),)
24+
ifneq ($(CONFIG_ENABLE_ALL_SIGNALS),)
2425
CONFIGURED_APPS += $(APPDIR)/examples/chrono
2526
endif
27+
endif

examples/djoystick/CMakeLists.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@
2020
#
2121
# ##############################################################################
2222

23-
if(CONFIG_EXAMPLES_DJOYSTICK)
23+
if(CONFIG_EXAMPLES_DJOYSTICK AND CONFIG_ENABLE_ALL_SIGNALS)
2424
nuttx_add_application(
2525
NAME
2626
djoy

examples/djoystick/Make.defs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,5 +21,7 @@
2121
############################################################################
2222

2323
ifneq ($(CONFIG_EXAMPLES_DJOYSTICK),)
24+
ifneq ($(CONFIG_ENABLE_ALL_SIGNALS),)
2425
CONFIGURED_APPS += $(APPDIR)/examples/djoystick
2526
endif
27+
endif

examples/i2sloop/CMakeLists.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@
2020
#
2121
# ##############################################################################
2222

23-
if(CONFIG_EXAMPLES_I2SLOOP)
23+
if(CONFIG_EXAMPLES_I2SLOOP AND CONFIG_ENABLE_ALL_SIGNALS)
2424
nuttx_add_application(
2525
NAME
2626
i2sloop

examples/i2sloop/Make.defs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,5 +21,7 @@
2121
############################################################################
2222

2323
ifneq ($(CONFIG_EXAMPLES_I2SLOOP),)
24+
ifneq ($(CONFIG_ENABLE_ALL_SIGNALS),)
2425
CONFIGURED_APPS += $(APPDIR)/examples/i2sloop
2526
endif
27+
endif

examples/ipforward/ipforward.c

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -542,8 +542,16 @@ static FAR void *ipfwd_receiver(FAR void *arg)
542542
int errcode;
543543
int i;
544544

545+
#ifdef CONFIG_DISABLE_ALL_SIGNALS
546+
pthread_setcancelstate(PTHREAD_CANCEL_ENABLE, NULL);
547+
pthread_setcanceltype(PTHREAD_CANCEL_DEFERRED, NULL);
548+
#endif
549+
545550
for (i = 0; i < IPFWD_NPACKETS; i++)
546551
{
552+
#ifdef CONFIG_DISABLE_ALL_SIGNALS
553+
pthread_testcancel();
554+
#endif
547555
nread = read(fwd->ia_fd, fwd->ia_buffer, IPFWD_BUFSIZE);
548556
if (nread < 0)
549557
{
@@ -840,7 +848,12 @@ int main(int argc, FAR char *argv[])
840848

841849
/* Wait for receiver thread to terminate */
842850

851+
#ifdef CONFIG_DISABLE_ALL_SIGNALS
852+
pthread_cancel(fwd.if_receiver);
853+
#else
843854
pthread_kill(fwd.if_receiver, 9);
855+
#endif
856+
844857
ret = pthread_join(fwd.if_receiver, &value);
845858
if (ret != OK)
846859
{

examples/oneshot/CMakeLists.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@
2020
#
2121
# ##############################################################################
2222

23-
if(CONFIG_EXAMPLES_ONESHOT)
23+
if(CONFIG_EXAMPLES_ONESHOT AND CONFIG_ENABLE_ALL_SIGNALS)
2424
nuttx_add_application(
2525
NAME
2626
${CONFIG_EXAMPLES_ONESHOT_PROGNAME}

0 commit comments

Comments
 (0)