shmget() gives EINVAL error

view full story

http://stackoverflow.com – I've been having a problem with shmget for a few hours now that I can't seem to figure out. Every time I try to make a call got shmget() it always returns with an EINVAL: "Invalid Argument" error. The important parts of the code are as follows: key_t generate_ipc_key() { key_t ipc_key = ftok(__FILE__, KEY); if(ipc_key < 0) { perror("Failed to Generate IPC Key"); exit(IPC_FAILURE); } return ipc_key; } int shared_memory_create(size_t memory_size) { int shm_key = shmget(generate_ipc_key(), memory_size, IPC_CREAT | 0666); if(shm_key < 0) { (HowTos)