5
Last change
on this file since 667501a was
667501a,
checked in by Joel Sherrill <joel@…>, on 10/02/19 at 21:49:00
|
termios: Add Capability to Generate SIGINTR and SIGQUIT
This patch adds the ability for termios to send SIGINTR on receipt
of VINTR and SIGQUIT for VKILL and return -1/EINTR from read() on
a termios channel. Importantly, this patch does not alter the default
behavior or force POSIX signal code in just because termios is used.
The application must explicitly enable the POSIX behavior of generating
a signal upon receipt of these characters. This is discussed in the
POSIX standard:
https://pubs.opengroup.org/onlinepubs/9699919799/basedefs/V1_chap11.html
Closes #3800.
|
-
Property mode set to
100644
|
File size:
756 bytes
|
Line | |
---|
1 | /** |
---|
2 | * @file |
---|
3 | * TERMIOS POSIX behavior on INTR and QUIT characters |
---|
4 | */ |
---|
5 | |
---|
6 | /* |
---|
7 | * COPYRIGHT (c) 1989-2012,2019. |
---|
8 | * On-Line Applications Research Corporation (OAR). |
---|
9 | * |
---|
10 | * SPDX-License-Identifier: BSD-2-Clause |
---|
11 | */ |
---|
12 | |
---|
13 | #if HAVE_CONFIG_H |
---|
14 | #include "config.h" |
---|
15 | #endif |
---|
16 | |
---|
17 | #include <rtems.h> |
---|
18 | #include <rtems/libio.h> |
---|
19 | #include <rtems/termiostypes.h> |
---|
20 | |
---|
21 | #include <signal.h> |
---|
22 | |
---|
23 | rtems_termios_isig_status_code rtems_termios_posix_isig_handler( |
---|
24 | unsigned char c, |
---|
25 | struct rtems_termios_tty *tty |
---|
26 | ) |
---|
27 | { |
---|
28 | if (c == tty->termios.c_cc[VINTR]) { |
---|
29 | raise(SIGINT); |
---|
30 | return RTEMS_TERMIOS_ISIG_INTERRUPT_READ; |
---|
31 | } |
---|
32 | |
---|
33 | if (c == tty->termios.c_cc[VQUIT]) { |
---|
34 | raise(SIGQUIT); |
---|
35 | return RTEMS_TERMIOS_ISIG_INTERRUPT_READ; |
---|
36 | } |
---|
37 | |
---|
38 | return RTEMS_TERMIOS_ISIG_WAS_NOT_PROCESSED; |
---|
39 | } |
---|
Note: See
TracBrowser
for help on using the repository browser.