I have seen that question on SO already but it wasn't clear to me the following case:
A shm has been created. So if I call in my case:
int shmid = shmget(key, sizeof(struct messageQueue), IPC_CREAT | S_IRWXU | IPC_EXCL);
shmid turns -1 if the shm already exists. But can i somewhere get it's ID? Or do I need to call shmget(...) without EXCL flag again in order to get the ID?
Thanks in advance
Normally,
IPC_CREAT | IPC_EXCLis used if you want to create and initialize a new memory block. E.g.:If you don't need to initialize it, you can skip the
IPC_EXCL:and if you don't need to create it, you can skip the
IPC_CREAT: