permission denied error creating POSIX semaphores
Can anyone tell me what area I should be looking in to solve a permission denied error when creating a POSIX semaphore?
I understand that the error means:
the semaphore already exists, and the permissions specified are denied OR the semaphore does not exist, and the permissions specified to create it are denied.
I have three Linux machines, all built with the RHEL 4 distro, using gcc -lrt to link and have the same user id & group id set.
(All three machines are from different vendors, not that the HW probably matters?).
I can create semaphores on two of the machines but not on the third. I am using the same code (NFS mounted machines). What could be set different on the machines that would cause the EACCES (permission denied) error on only one of them???Where/what exactly am I being denied permission to?
Here is my crude code:
** seminit.c -- sets up a POSIX semaphore
int main (int argc, char *argv)
mySem=sem_open("/name1", O_CREAT | O_EXCL, 0666, 2);
if (mySem == SEM_FAILED)
/* Check the error value */
if (errno == EACCES)
/* Permission is denied */
printf("Error: EACCESS Permission denied\n");
/* Show the other error */
printf("Some other error");
/* return; */
/* Process created the semaphore */
printf("Sample data written\n");
printf("Value of mySem=%d \n", a1);
** End seminit.c