[PATCH 12/18] libio: Add rtems_libio_iop_is_no_delay()

Sebastian Huber sebastian.huber at embedded-brains.de
Wed Sep 13 13:39:45 UTC 2017


Update #3082.
---
 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
@@ -1380,6 +1380,16 @@ static inline uint32_t rtems_libio_iop_flags( const rtems_libio_t *iop )
 }
 
 /**
+ * @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 df2a8a4bbb..37b330998a 100644
--- a/cpukit/libnetworking/rtems/rtems_syscall.c
+++ b/cpukit/libnetworking/rtems/rtems_syscall.c
@@ -793,7 +793,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;
-- 
2.12.3




More information about the devel mailing list