diff options
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 ); } |