I have a C++ application on Linux. The application uses shared memory created without IPC_PRIVATE. I can see shared memory segment ID and key using ipcs command. Other processes can access these segments, too.
Unfortunately, sometimes the key become 0 and no other process key access such a segment. I saw in relevant questions here that the value of 0 means that a segment is private. From the other side, I do not see how it can be done. Let alone that I do not do that explicitly.
My questions are:
- How can I investigate this problem?
- How can I see the segment state (private/shared) from the process?
- Can I change the segment state back to shared from within the process?