From bbcdc302cd901e11b5c43527b91ffb5344669338 Mon Sep 17 00:00:00 2001 From: Sebastian Huber Date: Wed, 13 Sep 2017 10:24:25 +0200 Subject: libio: Add rtems_libio_iop_is_no_delay() Update #3132. --- cpukit/libcsupport/include/rtems/libio.h | 10 ++++++++++ cpukit/libcsupport/src/termios.c | 2 +- cpukit/libfs/src/pipe/fifo.c | 2 +- cpukit/libnetworking/rtems/rtems_syscall.c | 2 +- 4 files changed, 13 insertions(+), 3 deletions(-) diff --git a/cpukit/libcsupport/include/rtems/libio.h b/cpukit/libcsupport/include/rtems/libio.h index 96d0c29d1e..702ec352b9 100644 --- a/cpukit/libcsupport/include/rtems/libio.h +++ b/cpukit/libcsupport/include/rtems/libio.h @@ -1379,6 +1379,16 @@ static inline uint32_t rtems_libio_iop_flags( const rtems_libio_t *iop ) return iop->flags; } +/** + * @brief Returns true if this is a no delay iop, otherwise returns false. + * + * @param[in] iop The iop. + */ +static inline bool rtems_libio_iop_is_no_delay( const rtems_libio_t *iop ) +{ + return ( rtems_libio_iop_flags( iop ) & LIBIO_FLAGS_NO_DELAY ) != 0; +} + /** * @name External I/O Handlers */ diff --git a/cpukit/libcsupport/src/termios.c b/cpukit/libcsupport/src/termios.c index c454e18470..7a114a74b9 100644 --- a/cpukit/libcsupport/src/termios.c +++ b/cpukit/libcsupport/src/termios.c @@ -1230,7 +1230,7 @@ static uint32_t rtems_termios_write_tty (rtems_libio_t *iop, rtems_termios_tty *tty, const char *buf, uint32_t len) { - bool wait = ((iop->flags & LIBIO_FLAGS_NO_DELAY) == 0); + bool wait = !rtems_libio_iop_is_no_delay (iop); if (tty->termios.c_oflag & OPOST) { uint32_t todo = len; diff --git a/cpukit/libfs/src/pipe/fifo.c b/cpukit/libfs/src/pipe/fifo.c index 78e02efc27..b237a6ddd0 100644 --- a/cpukit/libfs/src/pipe/fifo.c +++ b/cpukit/libfs/src/pipe/fifo.c @@ -32,7 +32,7 @@ #include "pipe.h" #define LIBIO_ACCMODE(_iop) (rtems_libio_iop_flags(_iop) & LIBIO_FLAGS_READ_WRITE) -#define LIBIO_NODELAY(_iop) ((_iop)->flags & LIBIO_FLAGS_NO_DELAY) +#define LIBIO_NODELAY(_iop) rtems_libio_iop_is_no_delay(_iop) static rtems_id pipe_semaphore = RTEMS_ID_NONE; diff --git a/cpukit/libnetworking/rtems/rtems_syscall.c b/cpukit/libnetworking/rtems/rtems_syscall.c index f1b7a3246b..2d468dc19f 100644 --- a/cpukit/libnetworking/rtems/rtems_syscall.c +++ b/cpukit/libnetworking/rtems/rtems_syscall.c @@ -794,7 +794,7 @@ rtems_bsdnet_fcntl (rtems_libio_t *iop, int cmd) rtems_bsdnet_semaphore_release (); return EBADF; } - if (iop->flags & LIBIO_FLAGS_NO_DELAY) + if (rtems_libio_iop_is_no_delay(iop)) so->so_state |= SS_NBIO; else so->so_state &= ~SS_NBIO; -- cgit v1.2.3