Semget, linux c++

view story

http://stackoverflow.com – Why can't i open semget with 4 semaphores for its semaphore set? ie.: semget(key_t key, int nsems, int semflg); calling the above function with nsms as 3 is fine, but with 4 it returns minus 1.. int sempahore = semget((key_t)key,4,IPC_CREAT | MY_PERMS); The above code only works if i change 4 for 3 other wise errno returns invalid arguments (HowTos)