Changeset 694e946d in rtems for cpukit/posix/src/mmap.c


Ignore:
Timestamp:
Sep 6, 2017, 5:31:48 AM (3 years ago)
Author:
Sebastian Huber <sebastian.huber@…>
Branches:
5, master
Children:
ead1281f
Parents:
18b32d76
git-author:
Sebastian Huber <sebastian.huber@…> (09/06/17 05:31:48)
git-committer:
Sebastian Huber <sebastian.huber@…> (09/14/17 05:02:28)
Message:

libio: Remove special-case reference count

The top-level IO library structures should contain no special-case data.

Update #2859.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • cpukit/posix/src/mmap.c

    r18b32d76 r694e946d  
    4949  bool            map_shared;
    5050  bool            map_private;
     51  bool            is_shared_shm;
    5152  int             err;
    5253
     
    195196  mapping->len = len;
    196197  mapping->flags = flags;
    197   mapping->iop = iop;
    198198
    199199  if ( !map_anonymous ) {
     
    207207         S_ISCHR( sb.st_mode ) || S_ISFIFO( sb.st_mode ) ||
    208208         S_ISSOCK( sb.st_mode ) ) {
    209       mapping->is_shared_shm = false;
     209      is_shared_shm = false;
    210210    } else {
    211       mapping->is_shared_shm = true;
     211      is_shared_shm = true;
    212212    }
    213213  } else {
    214     mapping->is_shared_shm = false;
     214    is_shared_shm = false;
    215215  }
    216216
     
    219219  } else if ( map_private ) {
    220220    /* private mappings of shared memory do not need special treatment. */
    221     mapping->is_shared_shm = false;
     221    is_shared_shm = false;
    222222    posix_memalign( &mapping->addr, PAGE_SIZE, len );
    223223    if ( !mapping->addr ) {
     
    229229
    230230  /* MAP_FIXED is not supported for shared memory objects with MAP_SHARED. */
    231   if ( map_fixed && mapping->is_shared_shm ) {
     231  if ( map_fixed && is_shared_shm ) {
    232232    free( mapping );
    233233    errno = ENOTSUP;
     
    281281    }
    282282  } else if ( map_shared ) {
     283    if ( is_shared_shm ) {
     284      /* FIXME: This use of implementation details is a hack. */
     285      mapping->shm = iop_to_shm( iop );
     286    }
     287
    283288    err = (*iop->pathinfo.handlers->mmap_h)(
    284289        iop, &mapping->addr, len, prot, off );
     
    290295  }
    291296
    292   if ( iop != NULL ) {
    293     /* add an extra reference to the file associated with fildes that
    294      * is not removed by a subsequent close().  This reference shall be removed
    295      * when there are no more mappings to the file. */
    296     rtems_libio_increment_mapping_refcnt(iop);
    297   }
    298 
    299297  rtems_chain_append_unprotected( &mmap_mappings, &mapping->node );
    300298
Note: See TracChangeset for help on using the changeset viewer.