invalid argument in semctl()

When I am using the function semctl() it is giving me error as the INVALID ARGUMENT. Can any body give me the possible reasons???

Can you be more specfic? By 'invalid argument" do you mean EINVAL? What command (i.e the 3rd argument to semctl()) were you attempting?

Thanks for your reply!!!! I have solved my problem. Actually the kernel of my server has a lots of semafore. So I can not create new semafore. I have used the command ipcrm -s <semafore id> to remove some of the semafore.

After this it worked fine.