|
|
#include <semaphore.h>sem_t *sem_open(const char *name, int oflag,...);
mode_t
,
and value, which is of type unsigned int
. The
semaphore is created with an initial value of value. Valid
initial values for semaphores must be less than or equal to
{SEM_VALUE_MAX}.
The semaphore's user ID is set to the effective user ID of the process; the semaphore's group ID is set to a system default group ID or to the effective group ID of the process. The semaphore's permission bits are set to the value of the mode argument except those set in the file mode creation mask of the process.
After the semaphore named name has been created by sem_open with the O_CREAT flag, other processes can connect to the semaphore by calling sem_open with the same value of name.
The name argument points to a string naming a semaphore object. The name argument must conform to the construction rules for a pathname. If name begins with the slash character, then processes calling sem_open with the same value of name refer to the same semaphore object, as long as that name has not been removed.
If a process makes multiple successful calls to sem_open with the same value for name, the same semaphore address is returned for each such successful call, provided that there have been no calls to sem_unlink(S) for this semaphore.