VMS Help  —  CRTL  semget  Description
    The semget function returns the semaphore identifier associated
    with key.

    A semaphore identifier with its associated semid_ds data
    structure and its associated set of nsems semaphores (see
    the <sys/sem.h> header file) is created for key if one of the
    following is true:

    o  The key argument is equal to IPC_PRIVATE.

    o  The key argument does not already have a semaphore identifier
       associated with it and (semflg &IPC_CREAT) is nonzero.

    When it is created, the semid_ds data structure associated with
    the new semaphore identifier is initialized as follows:

    o  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 process.

    o  The low-order 9 bits of sem_perm.mode are set equal to the
       low-order 9 bits of the semflg argument.

    o  The variable sem_nsems is set equal to the value of the nsems
       argument.

    o  The variable sem_otime is set equal to 0 and the variable sem_
       ctime is set equal to the current time.

    o  The data structure associated with each semaphore in the
       set does not need to be initialized. You can use the semctl
       function with the command SETVAL or SETALL to initialize each
       semaphore.
Close Help