#include <sys/sem.h>
sys/sem.h
$NetBSD: sem.h,v 1.5 1994/06/29 06:45:15 cgd Exp $
macrosemid_ds
#define semid_ds __semid_ds_new
struct__semid_ds_new
| struct ipc_perm | sem_perm | [XSI] operation permission struct |
| __int32_t | sem_base | 32 bit base ptr for semaphore set |
| unsigned short | sem_nsems | [XSI] number of sems in set |
| time_t | sem_otime | [XSI] last operation time |
| __int32_t | sem_pad1 | RESERVED: DO NOT USE! |
| time_t | sem_ctime | [XSI] last change time |
| __int32_t | sem_pad2 | Times measured in secs since 00:00:00 GMT, Jan. 1, 1970 RESERVED: DO NOT USE! |
| __int32_t[4] | sem_pad3 | RESERVED: DO NOT USE! |
macroGETNCNT
Possible values for the third argument to semctl()
#define GETNCNT 3
[XSI] Return the value of semncnt {READ}
structsem
A semaphore; this is an anonymous structure, not for external use
| unsigned short | semval | semaphore value |
| pid_t | sempid | pid of last operation |
| unsigned short | semncnt | # awaiting semval > cval |
| unsigned short | semzcnt | # awaiting semval == 0 |
structsembuf
Structure of array element for second argument to semop()
| unsigned short | sem_num | [XSI] semaphore # |
| short | sem_op | [XSI] semaphore operation |
| short | sem_flg | [XSI] operation flags |
macroSEM_UNDO
Possible flag values for sem_flg
#define SEM_UNDO 010000
[XSI] Set up adjust on exit entry
unionsemun
Union used as the fourth argment to semctl() in all cases. Specific
member values are used for different values of the third parameter:
Command Member
------------------------------------------- ------
GETALL, SETALL array
SETVAL val
IPC_STAT, IPC_SET buf
The union definition is intended to be defined by the user application
in conforming applications; it is provided here for two reasons:
1) Historical source compatability for non-conforming applications
expecting this header to declare the union type on their behalf
2) Documentation; specifically, 64 bit applications that do not pass
this structure for 'val', or, alternately, a 64 bit type, will
not function correctly
| int | val | value for SETVAL |
| struct __semid_ds_new * | buf | buffer for IPC_STAT & IPC_SET |
| unsigned short * | array | array for GETALL & SETALL |
functionsemsys
int semsys(int, ...)
functionsemctl
__DARWIN_ALIAS(semctl)
int semctl(int, int, int, ...)man page · September 12, 1995
semctl(2) — control operations on a semaphore set