sched/signal: Add support for SIGPIPE. SIGPIPE uses SIG_SIGPIPE_ACTION which terminates process by default. It also could be ignored.

This commit is contained in:
liuhaitao 2019-10-17 11:29:39 -06:00 committed by Gregory Nutt
parent 7b89845035
commit b2f8a79c3b
3 changed files with 26 additions and 2 deletions

View file

@ -92,7 +92,7 @@
* SIGILL A Illegal instruction
* SIGINT T (3) Terminal interrupt signal
* SIGKILL T (3) Kill (cannot be caught or ignored)
* SIGPIPE T Write on a pipe with no one to read it
* SIGPIPE T (7) Write on a pipe with no one to read it
* SIGQUIT A Terminal quit signal
* SIGSEGV A Invalid memory reference
* SIGSTOP S (2) Stop executing (cannot be caught or ignored)
@ -132,6 +132,7 @@
* (4) The default action can be enabled with CONFIG_SIG_SIGUSR1_ACTION
* (5) The default action can be enabled with CONFIG_SIG_SIGUSR2_ACTION
* (6) The default action can be enabled with CONFIG_SIG_SIGPOLL_ACTION
* (7) The default action can be enabled with CONFIG_SIG_SIGPIPE_ACTION
*/
/* A few of the real time signals are used within the OS. They have
@ -190,6 +191,12 @@
# define SIGINT CONFIG_SIG_INT
#endif
#ifndef CONFIG_SIG_SIGPIPE
# define SIGPIPE 11
#else
# define SIGPIPE CONFIG_SIG_SIGPIPE
#endif
/* The following are non-standard signal definitions */
#ifndef CONFIG_DISABLE_PTHREAD

View file

@ -1414,6 +1414,12 @@ config SIG_SIGKILL_ACTION
Enable the default action for SIGINT and SIGKILL (terminate the
task).
config SIG_SIGPIPE_ACTION
bool "SIGPIPE"
default y
---help---
Enable the default action for SIGPIPE (terminate the task).
endif # SIG_DEFAULT
menu "Signal Numbers"
@ -1500,6 +1506,14 @@ config SIG_INT
endif # SIG_DEFAULT
config SIG_PIPE
int "SIGPIPE"
default 11
---help---
The SIGPIPE signal is sent to a task termination event.
This signal is generated when write on a pipe with no one to read it.
SIGPIPE may be ignored.
comment "Non-standard Signal Numbers"
config SIG_SIGCONDTIMEDOUT

View file

@ -138,7 +138,10 @@ static const struct nxsig_defaction_s g_defactions[] =
#endif
#ifdef CONFIG_SIG_SIGKILL_ACTION
{ SIGINT, 0, nxsig_abnormal_termination },
{ SIGKILL, SIG_FLAG_NOCATCH, nxsig_abnormal_termination }
{ SIGKILL, SIG_FLAG_NOCATCH, nxsig_abnormal_termination },
#endif
#ifdef CONFIG_SIG_SIGPIPE_ACTION
{ SIGPIPE, 0, nxsig_abnormal_termination }
#endif
};