Originally Posted by
MadDog
Thanks brewbuck,
Is there any way to know if a shmid was created through a particular key? I don't really care if the segment is marked for deletion or not. I just want to have a common shared segment for many independent processes. My problem is that attempting to get the shmid of a segment - that was previously created and marked for deletion - through shmget(my_key, ...) creates a new segment... What I want is that segment (the one I created in the first place), not just any segment marked for deletion...
You should be able to find the key with:
Code:
struct shmid_ds ds;
shmctl(shmid, IPC_STAT, &ds);
ds.shm_perm.key; /* Here's the key */