vuoi
o PayPal
tutte le volte che vuoi
semget
The Single UNIX ® Specification, Version 2
Copyright © 1997 The Open Group
NAME
semget - get set of semaphores
SYNOPSIS
#include <sys/sem.h> int semget(key_t int intkey, nsems, semflg);
DESCRIPTION
The semget() function returns the semaphore identifier associated with key.
A semaphore identifier with its associated data structure and its associated set of semid_dsnsems semaphores, see <sys/sem.h>, are created for key if one of the following is true:
- The argument key is equal to IPC_PRIVATE .
- The argument key does not already have a semaphore identifier associated with it and (semflg & IPC_CREAT) is non-zero.
Upon creation, the data structure associated with the new semaphore identifier is semid_ds initialised as follows:
In the operation permissions structure sem_perm.cuid, sem_perm.uid, sem_perm.cgid and sem_perm.gid are set equal to the effective user ID and effective group ID, respectively, of the calling
The low-order 9 bits of sem_perm.mode are set equal to the low-order 9 bits of semflg.
The variable sem_nsems is set equal to the value of nsems.
The variable sem_otime is set equal to 0 and sem_ctime is set equal to the current time.
The data structure associated with each semaphore in the set is not initialised. The semctl() function with the command SETVAL or SETALL can be used to initialise each semaphore.
RETURN VALUE
Upon successful completion, semget() returns a non-negative integer, namely a semaphore identifier; otherwise, it returns -1 and errno will be set to indicate the error.
ERRORS
The semget() function will fail if:
[EACCES]1 di 2 21/04/2010 14:07