From 153b26699ee10eb760816ca0d030fe4cd80e1ce7 Mon Sep 17 00:00:00 2001 From: Sebastian Huber Date: Thu, 7 May 2020 08:45:29 +0200 Subject: termios: Replace rtems_termios_isig_status_code Merge the rtems_termios_isig_status_code and rtems_termios_iproc_status_code enums into a single rtems_termios_iproc_status_code which is now a part of the API. Simplify rtems_termios_posix_isig_handler() to avoid unreachable code. Close #3800. --- cpukit/libcsupport/src/termios.c | 34 ++-------------------- .../libcsupport/src/termios_posix_isig_handler.c | 18 ++++++------ 2 files changed, 12 insertions(+), 40 deletions(-) (limited to 'cpukit/libcsupport') diff --git a/cpukit/libcsupport/src/termios.c b/cpukit/libcsupport/src/termios.c index 3690ee3fc3..75925cf8ec 100644 --- a/cpukit/libcsupport/src/termios.c +++ b/cpukit/libcsupport/src/termios.c @@ -1311,12 +1311,12 @@ static rtems_termios_isig_handler termios_isig_handler = * This is the default method to process VKILL or VQUIT characters if * ISIG processing is enabled. Note that it does nothing. */ -rtems_termios_isig_status_code rtems_termios_default_isig_handler( +rtems_termios_iproc_status_code rtems_termios_default_isig_handler( unsigned char c, struct rtems_termios_tty *tty ) { - return RTEMS_TERMIOS_ISIG_WAS_NOT_PROCESSED; + return RTEMS_TERMIOS_IPROC_CONTINUE; } /* @@ -1335,28 +1335,6 @@ rtems_status_code rtems_termios_register_isig_handler( return RTEMS_SUCCESSFUL; } -/** - * @brief Type returned by all input processing (iproc) methods - */ -typedef enum { - /** - * This indicates that the input processing can continue. - */ - RTEMS_TERMIOS_IPROC_CONTINUE, - /** - * This indicates that the input processing is done. - */ - RTEMS_TERMIOS_IPROC_DONE, - /** - * This indicates that the character was processed and determined - * to be one that requires a signal to be raised (e.g. VINTR or - * VKILL). The tty must be in the right termios mode for this to - * occur. There is no further processing of this character required and - * the pending read() operation should be interrupted. - */ - RTEMS_TERMIOS_IPROC_INTERRUPT -} rtems_termios_iproc_status_code; - /* * Process a single input character */ @@ -1369,13 +1347,7 @@ iproc (unsigned char c, struct rtems_termios_tty *tty) */ if ((tty->termios.c_lflag & ISIG)) { if ((c == tty->termios.c_cc[VINTR]) || (c == tty->termios.c_cc[VQUIT])) { - rtems_termios_isig_status_code rc; - rc = (*termios_isig_handler)(c, tty); - if (rc == RTEMS_TERMIOS_ISIG_INTERRUPT_READ) { - return RTEMS_TERMIOS_IPROC_INTERRUPT; - } - - return RTEMS_TERMIOS_IPROC_CONTINUE; + return (*termios_isig_handler)(c, tty); } } diff --git a/cpukit/libcsupport/src/termios_posix_isig_handler.c b/cpukit/libcsupport/src/termios_posix_isig_handler.c index 5be2d10aa2..5f505fecb4 100644 --- a/cpukit/libcsupport/src/termios_posix_isig_handler.c +++ b/cpukit/libcsupport/src/termios_posix_isig_handler.c @@ -20,20 +20,20 @@ #include -rtems_termios_isig_status_code rtems_termios_posix_isig_handler( +rtems_termios_iproc_status_code rtems_termios_posix_isig_handler( unsigned char c, struct rtems_termios_tty *tty ) { - if (c == tty->termios.c_cc[VINTR]) { - raise(SIGINT); - return RTEMS_TERMIOS_ISIG_INTERRUPT_READ; - } + int sig; - if (c == tty->termios.c_cc[VQUIT]) { - raise(SIGQUIT); - return RTEMS_TERMIOS_ISIG_INTERRUPT_READ; + if ( c == tty->termios.c_cc[ VQUIT ] ) { + sig = SIGQUIT; + } else { + sig = SIGINT; } - return RTEMS_TERMIOS_ISIG_WAS_NOT_PROCESSED; + (void) raise( sig ); + + return RTEMS_TERMIOS_IPROC_INTERRUPT; } -- cgit v1.2.3