I am using Shared Memory in a Client-Server Model. When my Server gets killed off by the user by using sigkill instead of sigterm / sigint I can't do anything about it (as intended), but my Shared Memory Object and Semaphores still exist in /dev/shm/.
The next time I start my Server I want to create a new object with exactly the same name, and - as intented - this fails and I exit my program.
The user would need to remove the objects on his own - which is certainly not the best thing.
How can I handle this?
I could just call shm_open() without the O_EXCL flag, ultimately destroying the purpose of this flag. Because maybe there is already an instance of my server running and uses this object.
Pulseaudio seems to use a combination of digits to keep it's objects distinct and doesn't get affected by killing it with -9, so there seems to be a way.