From ca90c6c1db3881ce5a44e06610a29a128e5455f2 Mon Sep 17 00:00:00 2001 From: Sebastian Huber Date: Wed, 13 Sep 2017 14:00:50 +0200 Subject: libio: Add rtems_libio_iop_flags_initialize() Update #3132. --- cpukit/posix/src/shmopen.c | 16 ++++++++++------ 1 file changed, 10 insertions(+), 6 deletions(-) (limited to 'cpukit/posix/src/shmopen.c') 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; } -- cgit v1.2.3