1 /* $NetBSD: sem.h,v 1.29 2009/01/19 19:39:41 christos Exp $ */
4 * Copyright (c) 1999 The NetBSD Foundation, Inc.
7 * This code is derived from software contributed to The NetBSD Foundation
8 * by Jason R. Thorpe of the Numerical Aerospace Simulation Facility,
9 * NASA Ames Research Center.
11 * Redistribution and use in source and binary forms, with or without
12 * modification, are permitted provided that the following conditions
14 * 1. Redistributions of source code must retain the above copyright
15 * notice, this list of conditions and the following disclaimer.
16 * 2. Redistributions in binary form must reproduce the above copyright
17 * notice, this list of conditions and the following disclaimer in the
18 * documentation and/or other materials provided with the distribution.
20 * THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS
21 * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
22 * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
23 * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS
24 * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
25 * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
26 * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
27 * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
28 * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
29 * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
30 * POSSIBILITY OF SUCH DAMAGE.
34 * SVID compatible sem.h file
36 * Author: Daniel Boulet
42 #include <sys/featuretest.h>
47 struct ipc_perm sem_perm
; /* operation permission struct */
48 time_t sem_otime
; /* last semop() time */
49 unsigned long int __unused1
;
50 time_t sem_ctime
; /* last time changed by semctl() */
51 unsigned long int __unused2
;
52 unsigned long int sem_nsems
; /* number of semaphores in set */
53 unsigned long int __unused3
;
54 unsigned long int __unused4
;
58 * semop's sops parameter structure
61 unsigned short sem_num
; /* semaphore # */
62 short sem_op
; /* semaphore operation */
63 short sem_flg
; /* operation flags */
65 #define SEM_UNDO 0x1000 /* undo changes on process exit */
70 #define GETPID 11 /* get sempid */
71 #define GETVAL 12 /* get semval */
72 #define GETALL 13 /* get all semval's */
73 #define GETNCNT 14 /* get semncnt */
74 #define GETZCNT 15 /* get semzcnt */
75 #define SETVAL 16 /* set semval */
76 #define SETALL 17 /* set all semval's */
85 * semaphore info struct
88 int32_t semmap
; /* # of entries in semaphore map */
89 int32_t semmni
; /* # of semaphore identifiers */
90 int32_t semmns
; /* # of semaphores in system */
91 int32_t semmnu
; /* # of undo structures in system */
92 int32_t semmsl
; /* max # of semaphores per id */
93 int32_t semopm
; /* max # of operations per semop call */
94 int32_t semume
; /* max # of undo entries per process */
95 int32_t semusz
; /* size in bytes of undo structure */
96 int32_t semvmx
; /* semaphore maximum value */
97 int32_t semaem
; /* adjust on exit max value */
100 #endif /* __USE_MISC */
103 * Configuration parameters
107 #define SEMMNS (SEMMSL*SEMMNI)
113 #include <sys/cdefs.h>
116 int semctl(int, int, int, ...);
117 int semget(key_t
, int, int);
118 int semop(int, struct sembuf
*, size_t);
121 #endif /* !_SYS_SEM_H_ */