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