diff options
author | Gedare Bloom <gedare@rtems.org> | 2017-03-15 14:31:00 -0400 |
---|---|---|
committer | Gedare Bloom <gedare@rtems.org> | 2017-05-05 10:34:08 -0400 |
commit | 87de70a2984cece87db94f4b445589c4e24e5c77 (patch) | |
tree | 945d211b09e3b7714a2bba6d06ceae7a601d4116 /cpukit/posix/src/shmopen.c | |
parent | posix: Add mmap/unmap support for mapping files. (diff) | |
download | rtems-87de70a2984cece87db94f4b445589c4e24e5c77.tar.bz2 |
posix/mman: add mmap support for shm objects
Update #2859.
Diffstat (limited to 'cpukit/posix/src/shmopen.c')
-rw-r--r-- | cpukit/posix/src/shmopen.c | 23 |
1 files changed, 1 insertions, 22 deletions
diff --git a/cpukit/posix/src/shmopen.c b/cpukit/posix/src/shmopen.c index bedde1513f..fa1027e30c 100644 --- a/cpukit/posix/src/shmopen.c +++ b/cpukit/posix/src/shmopen.c @@ -93,34 +93,13 @@ static int shm_ftruncate( rtems_libio_t *iop, off_t length ) static int shm_close( rtems_libio_t *iop ) { POSIX_Shm_Control *shm = iop_to_shm( iop ); - Objects_Control *obj; - ISR_lock_Context lock_ctx; int err; err = 0; - _Objects_Allocator_lock(); - - --shm->reference_count; - if ( shm->reference_count == 0 ) { - /* TODO: need to make sure this counts mmaps too! */ - if ( (*shm->shm_object.ops->object_delete)( &shm->shm_object ) != 0 ) { - err = EIO; - } - /* check if the object has been unlinked yet. */ - obj = _Objects_Get( shm->Object.id, &lock_ctx, &_POSIX_Shm_Information ); - if ( obj == NULL ) { - /* if it was unlinked, then it can be freed. */ - _POSIX_Shm_Free( shm ); - } else { - /* it will be freed when it is unlinked. */ - _ISR_lock_ISR_enable( &lock_ctx ); - } - } + POSIX_Shm_Attempt_delete(shm); iop->pathinfo.node_access = NULL; - _Objects_Allocator_unlock(); - if ( err != 0 ) { rtems_set_errno_and_return_minus_one( err ); } |