summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorSebastian Huber <sebastian.huber@embedded-brains.de>2017-09-13 13:30:30 +0200
committerSebastian Huber <sebastian.huber@embedded-brains.de>2017-09-15 10:27:12 +0200
commite2b1db231196e0c395d0e19d9b35c0d7da2a5d3e (patch)
treefea75571834f5a92d667df159c9444ae9231d4e1
parentlibio: Add rtems_libio_iop_flags_initialize() (diff)
downloadrtems-e2b1db231196e0c395d0e19d9b35c0d7da2a5d3e.tar.bz2
libio: Add rtems_libio_iop_flags()
Update #3132.
-rw-r--r--cpukit/libcsupport/include/rtems/libio.h5
-rw-r--r--cpukit/libcsupport/src/fcntl.c10
-rw-r--r--cpukit/libfs/src/pipe/fifo.c2
-rw-r--r--cpukit/libnetworking/rtems/rtems_syscall.c2
4 files changed, 12 insertions, 7 deletions
diff --git a/cpukit/libcsupport/include/rtems/libio.h b/cpukit/libcsupport/include/rtems/libio.h
index 99d1565bef..96d0c29d1e 100644
--- a/cpukit/libcsupport/include/rtems/libio.h
+++ b/cpukit/libcsupport/include/rtems/libio.h
@@ -1374,6 +1374,11 @@ typedef struct {
/** @} */
+static inline uint32_t rtems_libio_iop_flags( const rtems_libio_t *iop )
+{
+ return iop->flags;
+}
+
/**
* @name External I/O Handlers
*/
diff --git a/cpukit/libcsupport/src/fcntl.c b/cpukit/libcsupport/src/fcntl.c
index 82052011ec..d44d4a0c1e 100644
--- a/cpukit/libcsupport/src/fcntl.c
+++ b/cpukit/libcsupport/src/fcntl.c
@@ -30,7 +30,7 @@ static int duplicate_iop( rtems_libio_t *iop )
int oflag;
rtems_libio_t *diop;
- oflag = rtems_libio_to_fcntl_flags( iop->flags );
+ oflag = rtems_libio_to_fcntl_flags( rtems_libio_iop_flags( iop ) );
diop = rtems_libio_allocate();
if (diop != NULL) {
@@ -72,12 +72,12 @@ static int duplicate2_iop( rtems_libio_t *iop, int fd2 )
{
int oflag;
- if ((iop2->flags & LIBIO_FLAGS_OPEN) != 0) {
+ if ((rtems_libio_iop_flags( iop2 ) & LIBIO_FLAGS_OPEN) != 0) {
rv = (*iop2->pathinfo.handlers->close_h)( iop2 );
}
if (rv == 0) {
- oflag = rtems_libio_to_fcntl_flags( iop->flags );
+ oflag = rtems_libio_to_fcntl_flags( rtems_libio_iop_flags( iop ) );
rtems_libio_iop_flags_set( iop2, rtems_libio_fcntl_flags( oflag ) );
rtems_filesystem_instance_lock( &iop->pathinfo );
@@ -135,7 +135,7 @@ static int vfcntl(
break;
case F_GETFD: /* get f_flags */
- ret = ((iop->flags & LIBIO_FLAGS_CLOSE_ON_EXEC) != 0);
+ ret = ((rtems_libio_iop_flags(iop) & LIBIO_FLAGS_CLOSE_ON_EXEC) != 0);
break;
case F_SETFD: /* set f_flags */
@@ -154,7 +154,7 @@ static int vfcntl(
break;
case F_GETFL: /* more flags (cloexec) */
- ret = rtems_libio_to_fcntl_flags( iop->flags );
+ ret = rtems_libio_to_fcntl_flags( rtems_libio_iop_flags( iop ) );
break;
case F_SETFL:
diff --git a/cpukit/libfs/src/pipe/fifo.c b/cpukit/libfs/src/pipe/fifo.c
index 15fb0d58eb..78e02efc27 100644
--- a/cpukit/libfs/src/pipe/fifo.c
+++ b/cpukit/libfs/src/pipe/fifo.c
@@ -31,7 +31,7 @@
#include "pipe.h"
-#define LIBIO_ACCMODE(_iop) ((_iop)->flags & LIBIO_FLAGS_READ_WRITE)
+#define LIBIO_ACCMODE(_iop) (rtems_libio_iop_flags(_iop) & LIBIO_FLAGS_READ_WRITE)
#define LIBIO_NODELAY(_iop) ((_iop)->flags & LIBIO_FLAGS_NO_DELAY)
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 e1803202da..f1b7a3246b 100644
--- a/cpukit/libnetworking/rtems/rtems_syscall.c
+++ b/cpukit/libnetworking/rtems/rtems_syscall.c
@@ -52,7 +52,7 @@ rtems_bsdnet_fdToSocket (int fd)
iop = rtems_libio_iop(fd);
/* same as rtems_libio_check_is_open(iop) but different return */
- if ((iop->flags & LIBIO_FLAGS_OPEN) == 0) {
+ if ((rtems_libio_iop_flags(iop) & LIBIO_FLAGS_OPEN) == 0) {
errno = EBADF;
return NULL;
}