diff options
author | Sebastian Huber <sebastian.huber@embedded-brains.de> | 2017-09-13 14:00:50 +0200 |
---|---|---|
committer | Sebastian Huber <sebastian.huber@embedded-brains.de> | 2017-09-15 10:27:08 +0200 |
commit | ca90c6c1db3881ce5a44e06610a29a128e5455f2 (patch) | |
tree | f54ed2c4c10d7d73be307647553ca2f7971f6573 /cpukit/posix/src/shmopen.c | |
parent | libio: Add iop set/clear flags (diff) | |
download | rtems-ca90c6c1db3881ce5a44e06610a29a128e5455f2.tar.bz2 |
libio: Add rtems_libio_iop_flags_initialize()
Update #3132.
Diffstat (limited to '')
-rw-r--r-- | cpukit/posix/src/shmopen.c | 16 |
1 files changed, 10 insertions, 6 deletions
diff --git a/cpukit/posix/src/shmopen.c b/cpukit/posix/src/shmopen.c index e00869e30d..f6c9f58cb4 100644 --- a/cpukit/posix/src/shmopen.c +++ b/cpukit/posix/src/shmopen.c @@ -225,6 +225,7 @@ int shm_open( const char *name, int oflag, mode_t mode ) POSIX_Shm_Control *shm; size_t len; Objects_Get_by_name_error obj_err; + uint32_t flags; if ( shm_check_oflag( oflag ) != 0 ) { return -1; @@ -275,12 +276,6 @@ int shm_open( const char *name, int oflag, mode_t mode ) } fd = rtems_libio_iop_to_descriptor( iop ); - rtems_libio_iop_flags_set( iop, LIBIO_FLAGS_CLOSE_ON_EXEC ); - if ( oflag & O_RDONLY ) { - rtems_libio_iop_flags_set( iop, LIBIO_FLAGS_READ ); - } else { - rtems_libio_iop_flags_set( iop, LIBIO_FLAGS_READ_WRITE ); - } iop->data0 = fd; iop->data1 = shm; iop->pathinfo.node_access = shm; @@ -288,6 +283,15 @@ int shm_open( const char *name, int oflag, mode_t mode ) iop->pathinfo.mt_entry = &rtems_filesystem_null_mt_entry; rtems_filesystem_location_add_to_mt_entry( &iop->pathinfo ); + flags = LIBIO_FLAGS_CLOSE_ON_EXEC; + if ( oflag & O_RDONLY ) { + flags |= LIBIO_FLAGS_READ; + } else { + flags |= LIBIO_FLAGS_READ_WRITE; + } + + rtems_libio_iop_flags_initialize( iop, flags ); + return fd; } |