[rtems commit] libio: Add rtems_libio_iop_is_no_delay()

Sebastian Huber sebh at rtems.org
Fri Sep 15 09:00:12 UTC 2017


Module:    rtems
Branch:    master
Commit:    bbcdc302cd901e11b5c43527b91ffb5344669338
Changeset: http://git.rtems.org/rtems/commit/?id=bbcdc302cd901e11b5c43527b91ffb5344669338

Author:    Sebastian Huber <sebastian.huber at embedded-brains.de>
Date:      Wed Sep 13 10:24:25 2017 +0200

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 96d0c29..702ec35 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 c454e18..7a114a7 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 78e02ef..b237a6d 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 f1b7a32..2d468dc 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;



More information about the vc mailing list