From 87de70a2984cece87db94f4b445589c4e24e5c77 Mon Sep 17 00:00:00 2001 From: Gedare Bloom Date: Wed, 15 Mar 2017 14:31:00 -0400 Subject: posix/mman: add mmap support for shm objects Update #2859. --- cpukit/posix/src/shmopen.c | 23 +---------------------- 1 file changed, 1 insertion(+), 22 deletions(-) (limited to 'cpukit/posix/src/shmopen.c') 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 ); } -- cgit v1.2.3