Squashed commit of the following:

drivers/serial/Kconfig:  It is no longer necessary to restrict Ctrl-C handling to the FLAT build

    sched/signal:  Add a new configuration option to select signal default actions, separate handling of signal default actions from both task startup logic and from the serial TTY Ctrl-C logic.  Add a signal set in the group structure to keep track of what signals have been set to the default action.  In dispatching signals in PROTECTED or KERNEL mode, use this signal set to determine if the default signal handler is attached and dispatch the signal in kernel mode for the default actions.
This commit is contained in:
Gregory Nutt
2018-08-27 11:40:09 -06:00
parent 798922b9c6
commit c0d234a474
12 changed files with 372 additions and 89 deletions
+11 -3
View File
@@ -19,14 +19,22 @@ config SERIAL_CONSOLE
bool
default n
config SERIAL_SIGKILL_CHAR
config TTY_SIGKILL
bool "Support SIGKILL"
default n
select SIG_DEFAULT
depends on !DISABLE_SIGNALS
---help---
Whether support Ctrl-c/x event
config TTY_SIGKILL_CHAR
int "Serial parse SIGKILL characters"
default 3 if SERIAL_CONSOLE
default 4 if !SERIAL_CONSOLE
depends on SIG_SIGKILL && BUILD_FLAT
depends on SIG_SIGKILL
---help---
Use ASCII 3 (Ctrl-c) or 4 (ctrl-d) inputs to determine whether to
send a SIGKILL event. Other charcters may also be selected.
send a SIGKILL event. Other characters may also be selected.
REVISIT: Traditionally Ctrl-C would generate SIGINT. Ctrl-D is the
End-of-File character that should close the stream.
+2 -2
View File
@@ -1372,7 +1372,7 @@ static int uart_ioctl(FAR struct file *filep, int cmd, unsigned long arg)
break;
#endif
#ifdef CONFIG_SERIAL_SIGKILL_CHAR
#ifdef CONFIG_TTY_SIGKILL_CHAR
/* Make the given terminal the controlling terminal of the calling process */
case TIOCSCTTY:
@@ -1600,7 +1600,7 @@ errout:
int uart_register(FAR const char *path, FAR uart_dev_t *dev)
{
#ifdef CONFIG_SERIAL_SIGKILL_CHAR
#ifdef CONFIG_TTY_SIGKILL_CHAR
/* Initialize of the task that will receive SIGKILL signals. */
dev->pid = -1;
+5 -5
View File
@@ -60,14 +60,14 @@
*
************************************************************************************/
#ifdef CONFIG_SIG_SIGKILL
#ifdef CONFIG_TTY_SIGKILL
static bool uart_check_sigkill(const char *buf, size_t size)
{
size_t i;
for (i = 0; i < size; i++)
{
if (buf[i] == CONFIG_SERIAL_SIGKILL_CHAR)
if (buf[i] == CONFIG_TTY_SIGKILL_CHAR)
{
return true;
}
@@ -88,7 +88,7 @@ static bool uart_check_sigkill(const char *buf, size_t size)
*
************************************************************************************/
#ifdef CONFIG_SIG_SIGKILL
#ifdef CONFIG_TTY_SIGKILL
static bool uart_recvchars_sigkill(FAR uart_dev_t *dev)
{
FAR struct uart_dmaxfer_s *xfer = &dev->dmarx;
@@ -324,7 +324,7 @@ void uart_recvchars_done(FAR uart_dev_t *dev)
FAR struct uart_dmaxfer_s *xfer = &dev->dmarx;
FAR struct uart_buffer_s *rxbuf = &dev->recv;
size_t nbytes = xfer->nbytes;
#ifdef CONFIG_SIG_SIGKILL
#ifdef CONFIG_TTY_SIGKILL
bool needkill = false;
/* Check if the SIGKILL character is anywhere in the newly received DMA buffer. */
@@ -350,7 +350,7 @@ void uart_recvchars_done(FAR uart_dev_t *dev)
uart_datareceived(dev);
}
#ifdef CONFIG_SIG_SIGKILL
#ifdef CONFIG_TTY_SIGKILL
/* Send the SIGKILL signal if needed */
if (needkill)
+4 -4
View File
@@ -123,7 +123,7 @@ void uart_recvchars(FAR uart_dev_t *dev)
#ifdef CONFIG_SERIAL_IFLOWCONTROL_WATERMARKS
unsigned int watermark;
#endif
#ifdef CONFIG_SIG_SIGKILL
#ifdef CONFIG_TTY_SIGKILL
bool needkill = false;
#endif
unsigned int status;
@@ -201,10 +201,10 @@ void uart_recvchars(FAR uart_dev_t *dev)
ch = uart_receive(dev, &status);
#ifdef CONFIG_SIG_SIGKILL
#ifdef CONFIG_TTY_SIGKILL
/* Is this the special character that will generate the SIGKILL signal? */
if (dev->pid >= 0 && ch == CONFIG_SERIAL_SIGKILL_CHAR)
if (dev->pid >= 0 && ch == CONFIG_TTY_SIGKILL_CHAR)
{
/* Yes.. not the the kill is needed and do not put the character into
* the Rx buffer. It should not be read as normal data.
@@ -249,7 +249,7 @@ void uart_recvchars(FAR uart_dev_t *dev)
uart_datareceived(dev);
}
#ifdef CONFIG_SIG_SIGKILL
#ifdef CONFIG_TTY_SIGKILL
/* Send the SIGKILL signal if needed */
if (needkill)