#2859 closed defect (fixed)

Implement POSIX Shared Memory Objects

Reported by: Gedare Bloom Owned by: Gedare Bloom
Priority: normal Milestone: 5.1
Component: posix Version: 5
Severity: normal Keywords: POSIX-Compliance
Cc: Blocked By:


POSIX Shared Memory is a widely used API for inter-process communication. The functions in the API include:

Change History (18)

comment:2 Changed on Jan 25, 2017 at 12:33:07 PM by Sebastian Huber <sebastian.huber@…>

In 7cb7454f9321f9d68ad79c7bc21458755a4a6b46/rtems:

psxtests: Relax shared memory tests

There is currently no proper mmap() implementation.

Update #2859.

comment:3 Changed on Apr 4, 2017 at 12:03:21 AM by Joel Sherrill

Keywords: POSIX-Compliance added; posix removed

comment:4 Changed on May 5, 2017 at 3:26:56 PM by Gedare Bloom <gedare@…>

In 87de70a2/rtems:

posix/mman: add mmap support for shm objects

Update #2859.

comment:5 Changed on May 11, 2017 at 7:31:02 AM by Sebastian Huber


comment:6 Changed on Jul 14, 2017 at 8:04:27 PM by Kevin Kirspel <kevin-kirspel@…>

In 1549beb/rtems:

psxtests: Add a mmap dedicated test case

Updates #2859

comment:7 Changed on Jul 18, 2017 at 12:22:46 PM by Sebastian Huber

Test psxmmap01 fails with RTEMS_DEBUG:

Init: mmap - map at zero

Breakpoint 1, __assert_func (file=file@entry=0x2027fc8 "../../cpukit/../../../erc32/lib/include/rtems/score/chainimpl.h", line=line@entry=686, func=func@entry=0x2029198 <__func__.2359> "_Chain_Append_unprotected", failedexpr=failedexpr@entry=0x20286e0 "_Chain_Is_node_off_chain( the_node )") at ../../../../../../rtems/c/src/../../cpukit/libcsupport/src/__assert.c:37
37      {
(gdb) bt
#0  __assert_func (file=file@entry=0x2027fc8 "../../cpukit/../../../erc32/lib/include/rtems/score/chainimpl.h", line=line@entry=686, func=func@entry=0x2029198 <__func__.2359> "_Chain_Append_unprotected", failedexpr=failedexpr@entry=0x20286e0 "_Chain_Is_node_off_chain( the_node )") at ../../../../../../rtems/c/src/../../cpukit/libcsupport/src/__assert.c:37
#1  0x0200d688 in _Chain_Append_unprotected (the_node=0x2039450, the_chain=0x202f650 <mmap_mappings>) at ../../cpukit/../../../erc32/lib/include/rtems/score/chainimpl.h:686
#2  0x0200d720 in _Chain_Append_unprotected (the_node=0x2039450, the_chain=0x202f650 <mmap_mappings>) at ../../../../../../rtems/c/src/../../cpukit/sapi/src/chainprotected.c:74
#3  rtems_chain_append (chain=chain@entry=0x202f650 <mmap_mappings>, node=node@entry=0x2039450) at ../../../../../../rtems/c/src/../../cpukit/sapi/src/chainprotected.c:72
#4  0x0200a634 in mmap (addr=addr@entry=0xfffff000, len=len@entry=4096, prot=prot@entry=7, flags=<optimized out>, flags@entry=4114, fildes=fildes@entry=-1, off=<optimized out>) at ../../../../../../rtems/c/src/../../cpukit/posix/src/mmap.c:373
#5  0x020014cc in mmap_map_at_zero () at ../../../../../../../rtems/c/src/../../testsuites/psxtests/psxmmap01/init.c:100
#6  POSIX_Init (argument=<optimized out>) at ../../../../../../../rtems/c/src/../../testsuites/psxtests/psxmmap01/init.c:324
#7  0x0201be58 in _Thread_Entry_adaptor_pointer (executing=0x20318d8) at ../../../../../../rtems/c/src/../../cpukit/score/src/threadentryadaptorpointer.c:25
#8  0x0201bed4 in _Thread_Handler () at ../../../../../../rtems/c/src/../../cpukit/score/src/threadhandler.c:88
#9  0x0201be6c in _Thread_Handler () at ../../../../../../rtems/c/src/../../cpukit/score/src/threadhandler.c:38
(gdb) frame 3
#3  rtems_chain_append (chain=chain@entry=0x202f650 <mmap_mappings>, node=node@entry=0x2039450) at ../../../../../../rtems/c/src/../../cpukit/sapi/src/chainprotected.c:72
72        _Chain_Append_unprotected( chain, node );
(gdb) p *node
$1 = {
  next = 0x202f654 <mmap_mappings+4>, 
  previous = 0x202f650 <mmap_mappings>

comment:8 Changed on Jul 20, 2017 at 5:30:57 AM by Kevin Kirspel <kevin-kirspel@…>

In bb01a36/rtems:

Fixed issue with searching mapped addresses

The loop that checks if the current address is already mapped uses
the same local variable for the chanin node as the newly allocated
chain node so the allocated chain node gets over written.

Added a new local variable for the loop that checks the address

Updates #2859.

comment:9 Changed on Jul 20, 2017 at 5:31:10 AM by Sebastian Huber <sebastian.huber@…>

In b965f461/rtems:

posix: Use unprotected chain operations

Operarations are already protected by mmap_mappings_lock.

Updates #2859.

comment:10 Changed on Jul 20, 2017 at 5:33:50 AM by Sebastian Huber

The mmap_mappings_lock attributes don't create a mutex:




I suggest to use the libio mutex and keep the specialized lock/unlock functions. Mutex lock/unlock should not return a status code to simplify the error handling.

comment:11 Changed on Jul 24, 2017 at 7:01:33 PM by Gedare Bloom <gedare@…>

In b264998/rtems:

posix: replace mmap mappings lock with libio lock

Use the libio mutex lock instead of the mmap mappings lock.

Updates #2859.

comment:12 Changed on Jul 24, 2017 at 7:14:54 PM by Gedare Bloom <gedare@…>

In c6d897e5/rtems:

posix: fix warnings with mmap from heap/wkspace

Avoid void pointer arithmetic.

Updates #2859.

comment:13 Changed on Jul 28, 2017 at 11:54:11 AM by Sebastian Huber <sebastian.huber@…>

In 77cbb2a/rtems:

psxtests/psxmmap01: Fix warning

Update #2859.

comment:14 Changed on Jul 28, 2017 at 7:16:13 PM by Gedare Bloom <gedare@…>

Resolution: fixed
Status: newclosed

In 1ab6d59/rtems-docs:

memory_management: update mmap, munmap, shm_open, shm_unlink

Close #2859.

comment:15 Changed on Jul 28, 2017 at 7:19:00 PM by Gedare Bloom

I consider this basically complete. Open new tickets against any bugs or added features.

comment:16 Changed on Sep 14, 2017 at 5:03:21 AM by Sebastian Huber <sebastian.huber@…>

In 694e946/rtems:

libio: Remove special-case reference count

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

Update #2859.

comment:17 Changed on Oct 16, 2017 at 6:17:09 AM by Sebastian Huber

Component: scoreposix

comment:18 Changed on Nov 9, 2017 at 6:27:14 AM by Sebastian Huber


Milestone renamed

Note: See TracTickets for help on using tickets.