I am trying to figure out what will happen if I use the  IPC_CREAT flag with shmget(). I have used a key of an already created shared memory segment from another process. When I did so, the calling process has shared actually this memory segment with the old process ( For sure I have attached this memory segment using shmat()). So can I conclude that if I use  IPC_CREAT with a shared memory segment that is already created the effect is that this memory will be shared with the calling process ?
                    
                        Add a comment
                    
                 | 
            
                
            
        
         
    1 Answer
Yes, that's the idea. You use IPC_CREAT to allow the creation, not to force it. To force creation (and failure if the key already exists), IPC_CREAT | IPC_EXCL.
