United States-English |
|
|
HP-UX Reference > Ssemget(2)HP-UX 11i Version 3: February 2007 |
|
NAMEsemget — get set of semaphores DESCRIPTIONsemget() returns the semaphore identifier associated with key. A semaphore identifier and associated data structure and set containing nsems semaphores are created for key if one of the following is true:
Specific behavior can be requested by ORing the following masks into semflg.
The low-order 9 bits of semflg are the semaphore operation permissions which are defined in glossary(9). Upon creation, the data structure associated with the new semaphore identifier is initialized as follows:
Security RestrictionsSome or all of the actions associated with this system call are subject to compartmental restrictions. See compartments(5) for more information about compartmentalization on systems that support that feature. Compartmental restrictions can be overridden if the process possesses the COMMALLOWED privilege (PRIV_COMMALLOWED). Processes owned by the superuser may not have this privilege. Processes owned by any user may have this privilege, depending on system configuration. See privileges(5) for more information about privileged access on systems that support fine-grained privileges. EXAMPLESThe following call to semget() returns a semid associated with the key returned by ftok("myfile", 'A'). If a semid associated with the key does not exist, a new semid, set of 4 semaphores, and associated data structure will be created. If a semid for the key already exists, the semid is simply returned. int semid; mysemid = semget (ftok("myfile",'A'), 4, IPC_CREAT | 0600); RETURN VALUEUpon successful completion, a non-negative integer, namely a semaphore identifier, is returned. Otherwise, a value of -1 is returned and errno is set to indicate the error. ERRORSsemget() fails if one or more of the following is true:
|
Printable version | ||
|