Changeset 153b2669 in rtems


Ignore:
Timestamp:
May 7, 2020, 6:45:29 AM (4 months ago)
Author:
Sebastian Huber <sebastian.huber@…>
Branches:
5, master
Children:
ea2d923
Parents:
ef9517b7
git-author:
Sebastian Huber <sebastian.huber@…> (05/07/20 06:45:29)
git-committer:
Sebastian Huber <sebastian.huber@…> (05/07/20 10:31:56)
Message:

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.

Location:
cpukit
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • cpukit/include/rtems/libio.h

    ref9517b7 r153b2669  
    19051905
    19061906/**
    1907  * @brief Type returned by all input processing (isig) methods
    1908  */
     1907 * @brief The status code returned by all Termios input processing (iproc)
     1908 * functions and input signal (isig) handlers.
     1909 */
    19091910typedef enum {
    19101911  /**
    1911    * This indicates that the input character was processed
    1912    * and possibly placed into the buffer.
     1912   * @brief This status indicates that the input processing can continue.
     1913   *
     1914   * Input signal handlers shall return this status if no signal was raised and
     1915   * the input processing can continue.
    19131916   */
    1914   RTEMS_TERMIOS_ISIG_WAS_PROCESSED,
     1917  RTEMS_TERMIOS_IPROC_CONTINUE,
     1918
    19151919  /**
    1916    * This indicates that the input character was not processed and
    1917    * subsequent processing is required.
     1920   * @brief This status indicates that the input processing should stop due to
     1921   * a signal.
     1922   *
     1923   * This indicates that the character was processed and determined to be one
     1924   * that requires a signal to be raised (e.g. VINTR or VKILL).  The tty must
     1925   * be in the right Termios mode for this to occur.  There is no further
     1926   * processing of this character required and the pending read() operation
     1927   * should be interrupted.
    19181928   */
    1919   RTEMS_TERMIOS_ISIG_WAS_NOT_PROCESSED,
     1929  RTEMS_TERMIOS_IPROC_INTERRUPT,
     1930
    19201931  /**
    1921    * This indicates that the character was processed and determined
    1922    * to be one that requires a signal to be raised (e.g. VINTR or
    1923    * VKILL). The tty must be in the right termios mode for this to
    1924    * occur. There is no further processing of this character required and
    1925    * the pending read() operation should be interrupted.
     1932   * @brief This status indicates that the input processing is done.
     1933   *
     1934   * This status shall not be returned by input processing signal handlers.
    19261935   */
    1927   RTEMS_TERMIOS_ISIG_INTERRUPT_READ
    1928 } rtems_termios_isig_status_code;
     1936  RTEMS_TERMIOS_IPROC_DONE
     1937} rtems_termios_iproc_status_code;
    19291938
    19301939/**
     
    19421951 *
    19431952 * @return The value returned is according to that documented
    1944  *         for @ref rtems_termios_isig_status_code.
    1945  */
    1946 typedef rtems_termios_isig_status_code (*rtems_termios_isig_handler)(
     1953 *         for @ref rtems_termios_iproc_status_code.
     1954 */
     1955typedef rtems_termios_iproc_status_code (*rtems_termios_isig_handler)(
    19471956  unsigned char             c,
    19481957  struct rtems_termios_tty *tty
     
    19671976 *         for all methods adhering to @ref rtems_termios_isig_handler.
    19681977 */
    1969 rtems_termios_isig_status_code rtems_termios_default_isig_handler(
     1978rtems_termios_iproc_status_code rtems_termios_default_isig_handler(
    19701979  unsigned char             c,
    19711980  struct rtems_termios_tty *tty
     
    19851994 *         for all methods adhering to @ref rtems_termios_isig_handler.
    19861995 */
    1987 rtems_termios_isig_status_code rtems_termios_posix_isig_handler(
     1996rtems_termios_iproc_status_code rtems_termios_posix_isig_handler(
    19881997  unsigned char             c,
    19891998  struct rtems_termios_tty *tty
  • cpukit/libcsupport/src/termios.c

    ref9517b7 r153b2669  
    13121312 * ISIG processing is enabled. Note that it does nothing.
    13131313 */
    1314 rtems_termios_isig_status_code rtems_termios_default_isig_handler(
     1314rtems_termios_iproc_status_code rtems_termios_default_isig_handler(
    13151315  unsigned char c,
    13161316  struct rtems_termios_tty *tty
    13171317)
    13181318{
    1319   return RTEMS_TERMIOS_ISIG_WAS_NOT_PROCESSED;
     1319  return RTEMS_TERMIOS_IPROC_CONTINUE;
    13201320}
    13211321
     
    13351335  return RTEMS_SUCCESSFUL;
    13361336}
    1337 
    1338 /**
    1339  * @brief Type returned by all input processing (iproc) methods
    1340  */
    1341 typedef enum {
    1342   /**
    1343    * This indicates that the input processing can continue.
    1344    */
    1345   RTEMS_TERMIOS_IPROC_CONTINUE,
    1346   /**
    1347    * This indicates that the input processing is done.
    1348    */
    1349   RTEMS_TERMIOS_IPROC_DONE,
    1350   /**
    1351    * This indicates that the character was processed and determined
    1352    * to be one that requires a signal to be raised (e.g. VINTR or
    1353    * VKILL). The tty must be in the right termios mode for this to
    1354    * occur. There is no further processing of this character required and
    1355    * the pending read() operation should be interrupted.
    1356    */
    1357   RTEMS_TERMIOS_IPROC_INTERRUPT
    1358 } rtems_termios_iproc_status_code;
    13591337
    13601338/*
     
    13701348  if ((tty->termios.c_lflag & ISIG)) {
    13711349    if ((c == tty->termios.c_cc[VINTR]) || (c == tty->termios.c_cc[VQUIT])) {
    1372       rtems_termios_isig_status_code rc;
    1373       rc = (*termios_isig_handler)(c, tty);
    1374       if (rc == RTEMS_TERMIOS_ISIG_INTERRUPT_READ) {
    1375          return RTEMS_TERMIOS_IPROC_INTERRUPT;
    1376       }
    1377 
    1378       return RTEMS_TERMIOS_IPROC_CONTINUE;
     1350      return (*termios_isig_handler)(c, tty);
    13791351    }
    13801352  }
  • cpukit/libcsupport/src/termios_posix_isig_handler.c

    ref9517b7 r153b2669  
    2121#include <signal.h>
    2222
    23 rtems_termios_isig_status_code rtems_termios_posix_isig_handler(
     23rtems_termios_iproc_status_code rtems_termios_posix_isig_handler(
    2424  unsigned char             c,
    2525  struct rtems_termios_tty *tty
    2626)
    2727{
    28   if (c == tty->termios.c_cc[VINTR]) {
    29     raise(SIGINT);
    30     return RTEMS_TERMIOS_ISIG_INTERRUPT_READ;
     28  int sig;
     29
     30  if ( c == tty->termios.c_cc[ VQUIT ] ) {
     31    sig = SIGQUIT;
     32  } else {
     33    sig = SIGINT;
    3134  }
    3235
    33   if (c == tty->termios.c_cc[VQUIT]) {
    34     raise(SIGQUIT);
    35     return RTEMS_TERMIOS_ISIG_INTERRUPT_READ;
    36   }
     36  (void) raise( sig );
    3737
    38   return RTEMS_TERMIOS_ISIG_WAS_NOT_PROCESSED;
     38  return RTEMS_TERMIOS_IPROC_INTERRUPT;
    3939}
Note: See TracChangeset for help on using the changeset viewer.