Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions examples/buttons/buttons_main.c
Original file line number Diff line number Diff line change
Expand Up @@ -219,9 +219,11 @@ static int button_daemon(int argc, char *argv[])
goto errout_with_fd;
}

#ifndef CONFIG_DISABLE_SIGNALS
/* Ignore the default signal action */

signal(CONFIG_EXAMPLES_BUTTONS_SIGNO, SIG_IGN);
#endif
#endif

/* Now loop forever, waiting BUTTONs events */
Expand Down
2 changes: 2 additions & 0 deletions examples/chrono/chrono_main.c
Original file line number Diff line number Diff line change
Expand Up @@ -165,9 +165,11 @@ static int chrono_daemon(int argc, char *argv[])
goto errout_with_fd;
}

#ifndef CONFIG_DISABLE_SIGNALS
/* Ignore the default signal action */

signal(BUTTON_SIGNO, SIG_IGN);
#endif

/* Now loop forever, waiting BUTTONs events */

Expand Down
2 changes: 1 addition & 1 deletion examples/timer/Kconfig
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
config EXAMPLES_TIMER
tristate "Timer example"
default n
depends on TIMER
depends on TIMER && !DISABLE_SIGNALS
---help---
Enable the timer example

Expand Down
16 changes: 16 additions & 0 deletions netutils/dhcpc/dhcpc.c
Original file line number Diff line number Diff line change
Expand Up @@ -533,8 +533,16 @@ static void *dhcpc_run(void *args)
struct dhcpc_state result;
int ret;

#ifdef CONFIG_DISABLE_SIGNALS
pthread_setcancelstate(PTHREAD_CANCEL_ENABLE, NULL);
pthread_setcanceltype(PTHREAD_CANCEL_DEFERRED, NULL);
#endif

while (1)
{
#ifdef CONFIG_DISABLE_SIGNALS
pthread_testcancel();
#endif
ret = dhcpc_request(pdhcpc, &result);
if (ret == OK)
{
Expand Down Expand Up @@ -701,7 +709,9 @@ void dhcpc_close(FAR void *handle)
void dhcpc_cancel(FAR void *handle)
{
struct dhcpc_state_s *pdhcpc = (struct dhcpc_state_s *)handle;
#ifndef CONFIG_DISABLE_SIGNALS
sighandler_t old;
#endif
int ret;

if (pdhcpc)
Expand All @@ -710,6 +720,9 @@ void dhcpc_cancel(FAR void *handle)

if (pdhcpc->thread)
{
#ifdef CONFIG_DISABLE_SIGNALS
pthread_cancel(pdhcpc->thread);
#else
old = signal(SIGQUIT, SIG_IGN);

/* Signal the dhcpc_run */
Expand All @@ -719,6 +732,7 @@ void dhcpc_cancel(FAR void *handle)
{
nerr("ERROR: pthread_kill DHCPC thread\n");
}
#endif

/* Wait for the end of dhcpc_run */

Expand All @@ -729,7 +743,9 @@ void dhcpc_cancel(FAR void *handle)
}

pdhcpc->thread = 0;
#ifndef CONFIG_DISABLE_SIGNALS
signal(SIGQUIT, old);
#endif
}
}
}
Expand Down
4 changes: 4 additions & 0 deletions netutils/ping/icmp_ping.c
Original file line number Diff line number Diff line change
Expand Up @@ -91,6 +91,7 @@ static volatile bool g_exiting;
* Private Functions
****************************************************************************/

#ifndef CONFIG_DISABLE_SIGNALS
/****************************************************************************
* Name: sigexit
****************************************************************************/
Expand All @@ -99,6 +100,7 @@ static void sigexit(int signo)
{
g_exiting = true;
}
#endif

/****************************************************************************
* Name: ping_newid
Expand Down Expand Up @@ -199,7 +201,9 @@ void icmp_ping(FAR const struct ping_info_s *info)
int i;

g_exiting = false;
#ifndef CONFIG_DISABLE_SIGNALS
signal(SIGINT, sigexit);
#endif

/* Initialize result structure */

Expand Down
6 changes: 3 additions & 3 deletions netutils/telnetd/telnetd_daemon.c
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,7 @@ int telnetd_daemon(FAR const struct telnetd_config_s *config)
#endif
} addr;

#ifdef CONFIG_SCHED_HAVE_PARENT
#if defined(CONFIG_SCHED_HAVE_PARENT) && !defined(CONFIG_DISABLE_SIGNALS)
struct sigaction sa;
sigset_t blockset;
#endif
Expand All @@ -85,7 +85,7 @@ int telnetd_daemon(FAR const struct telnetd_config_s *config)
int optval;
#endif

#ifdef CONFIG_SCHED_HAVE_PARENT
#if defined(CONFIG_SCHED_HAVE_PARENT) && !defined(CONFIG_DISABLE_SIGNALS)
/* Call sigaction with the SA_NOCLDWAIT flag so that we do not transform
* children into "zombies" when they terminate: Child exit status will
* not be retained.
Expand Down Expand Up @@ -113,7 +113,7 @@ int telnetd_daemon(FAR const struct telnetd_config_s *config)
nerr("ERROR: sigprocmask failed: %d\n", errno);
goto errout;
}
#endif /* CONFIG_SCHED_HAVE_PARENT */
#endif /* CONFIG_SCHED_HAVE_PARENT && !CONFIG_DISABLE_SIGNALS */

/* Create a new TCP socket to use to listen for connections */

Expand Down
23 changes: 17 additions & 6 deletions nshlib/nsh_builtin.c
Original file line number Diff line number Diff line change
Expand Up @@ -74,10 +74,14 @@ int nsh_builtin(FAR struct nsh_vtbl_s *vtbl, FAR const char *cmd,
FAR char **argv,
FAR const struct nsh_param_s *param)
{
#if !defined(CONFIG_NSH_DISABLEBG) && defined(CONFIG_SCHED_CHILD_STATUS)
#if !defined(CONFIG_NSH_DISABLEBG) && defined(CONFIG_SCHED_CHILD_STATUS) && \
!defined(CONFIG_DISABLE_SIGNALS)
struct sigaction act;
struct sigaction old;
#endif
#endif /* !CONFIG_NSH_DISABLEBG && CONFIG_SCHED_CHILD_STATUS &&
* !CONFIG_DISABLE_SIGNALS
*/

int ret = OK;

/* Lock the scheduler in an attempt to prevent the application from
Expand All @@ -86,7 +90,8 @@ int nsh_builtin(FAR struct nsh_vtbl_s *vtbl, FAR const char *cmd,

sched_lock();

#if !defined(CONFIG_NSH_DISABLEBG) && defined(CONFIG_SCHED_CHILD_STATUS)
#if !defined(CONFIG_NSH_DISABLEBG) && \
defined(CONFIG_SCHED_CHILD_STATUS) && !defined(CONFIG_DISABLE_SIGNALS)
/* Ignore the child status if run the application on background. */

if (vtbl->np.np_bg == true)
Expand All @@ -98,7 +103,9 @@ int nsh_builtin(FAR struct nsh_vtbl_s *vtbl, FAR const char *cmd,
sigaction(SIGCHLD, &act, &old);
}

#endif /* CONFIG_NSH_DISABLEBG */
#endif /* !CONFIG_NSH_DISABLEBG && !CONFIG_SCHED_CHILD_STATUS &&
* !CONFIG_DISABLE_SIGNALS
*/

/* Try to find and execute the command within the list of builtin
* applications.
Expand Down Expand Up @@ -230,7 +237,8 @@ int nsh_builtin(FAR struct nsh_vtbl_s *vtbl, FAR const char *cmd,

#if !defined(CONFIG_SCHED_WAITPID) || !defined(CONFIG_NSH_DISABLEBG)
{
#if !defined(CONFIG_NSH_DISABLEBG) && defined(CONFIG_SCHED_CHILD_STATUS)
#if !defined(CONFIG_NSH_DISABLEBG) && defined(CONFIG_SCHED_CHILD_STATUS) && \
!defined(CONFIG_DISABLE_SIGNALS)

/* Restore the old actions */

Expand All @@ -241,7 +249,10 @@ int nsh_builtin(FAR struct nsh_vtbl_s *vtbl, FAR const char *cmd,
sigaction(SIGCHLD, &old, NULL);
}

# endif
# endif /* !CONFIG_NSH_DISABLEBG && CONFIG_SCHED_CHILD_STATUS && \
* !CONFIG_DISABLE_SIGNALS
*/

struct sched_param sched;
sched_getparam(ret, &sched);
nsh_output(vtbl, "%s [%d:%d]\n", cmd, ret, sched.sched_priority);
Expand Down
9 changes: 8 additions & 1 deletion nshlib/nsh_proccmds.c
Original file line number Diff line number Diff line change
Expand Up @@ -873,6 +873,7 @@ static int top_cmpcpuload(FAR const void *item1, FAR const void *item2)
}
}

#ifndef CONFIG_DISABLE_SIGNALS
/****************************************************************************
* Name: top_exit
****************************************************************************/
Expand All @@ -882,7 +883,9 @@ static void top_exit(int signo, FAR siginfo_t *siginfo, FAR void *context)
*(FAR bool *)siginfo->si_user = true;
}

#endif
#endif /* !CONFIG_DISABLE_SIGNALS */

#endif /* !CONFIG_NSH_DISABLE_TOP && NSH_HAVE_CPULOAD */

/****************************************************************************
* Public Functions
Expand Down Expand Up @@ -1357,7 +1360,9 @@ int cmd_top(FAR struct nsh_vtbl_s *vtbl, int argc, FAR char **argv)
FAR char *pidlist = NULL;
size_t num = SIZE_MAX;
size_t i;
#ifndef CONFIG_DISABLE_SIGNALS
struct sigaction act;
#endif
bool quit = false;
int delay = 3;
int ret = 0;
Expand Down Expand Up @@ -1393,6 +1398,7 @@ int cmd_top(FAR struct nsh_vtbl_s *vtbl, int argc, FAR char **argv)
}
}

#ifndef CONFIG_DISABLE_SIGNALS
act.sa_user = &quit;
act.sa_sigaction = top_exit;
sigemptyset(&act.sa_mask);
Expand All @@ -1402,6 +1408,7 @@ int cmd_top(FAR struct nsh_vtbl_s *vtbl, int argc, FAR char **argv)
nsh_error(vtbl, g_fmtcmdfailed, "top", "sigaction", NSH_ERRNO);
return ERROR;
}
#endif

if (vtbl->isctty)
{
Expand Down
92 changes: 0 additions & 92 deletions system/cu/cu.h

This file was deleted.

Loading
Loading