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/shmheap.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/shmheap.c')
-rw-r--r-- | cpukit/posix/src/shmheap.c | 20 |
1 files changed, 20 insertions, 0 deletions
diff --git a/cpukit/posix/src/shmheap.c b/cpukit/posix/src/shmheap.c index 3449c15cca..47f5b4783a 100644 --- a/cpukit/posix/src/shmheap.c +++ b/cpukit/posix/src/shmheap.c @@ -70,6 +70,7 @@ int _POSIX_Shm_Object_resize_from_heap( return err; } +/* This is identical to _POSIX_Shm_Object_read_from_wkspace */ int _POSIX_Shm_Object_read_from_heap( POSIX_Shm_Object *shm_obj, void *buf, @@ -88,3 +89,22 @@ int _POSIX_Shm_Object_read_from_heap( return count; } +/* This is identical to _POSIX_Shm_Object_mmap_from_wkspace */ +void * _POSIX_Shm_Object_mmap_from_heap( + POSIX_Shm_Object *shm_obj, + size_t len, + int prot, + off_t off +) +{ + if ( shm_obj == NULL || shm_obj->handle == NULL ) + return 0; + + /* This is already checked by mmap. Maybe make it a debug assert? */ + if ( shm_obj->size < len + off ) { + return NULL; + } + + return &(shm_obj->handle[off]); +} + |