Given this code:
char * pathname; // some string
int returnValue = shm_open(pathname, O_CREAT | O_TRUNC | O_RDWR, mode); // create a shared memory object
If I do this: note – same pathname!)
int returnValue2 = shm_open(pathname, O_CREAT | O_TRUNC | O_RDWR, mode); // create a shared memory object
I get no error, and the return value is okay (0).
Does it mean that I’m recreating a shared memory segment/object?
You’re just re-opening the existing shared memory segment.
(From the Linux man shm_open.)
Additionally, from POSIX (a bit more explicit):