1 /* $NetBSD: sem.h,v 1.5 2009/01/11 02:45:50 christos Exp $ */
4 * SVID compatible sem.h file
6 * Author: Daniel Boulet
9 #ifndef _COMPAT_SYS_SEM_H_
10 #define _COMPAT_SYS_SEM_H_
12 #include <compat/sys/ipc.h>
15 struct ipc_perm14 sem_perm
; /* operation permission struct */
16 struct __sem
*sem_base
; /* pointer to first semaphore in set */
17 unsigned short sem_nsems
; /* number of sems in set */
18 int32_t sem_otime
; /* last operation time */
19 long sem_pad1
; /* SVABI/386 says I need this here */
20 int32_t sem_ctime
; /* last change time */
21 /* Times measured in secs since */
22 /* 00:00:00 GMT, Jan. 1, 1970 */
23 long sem_pad2
; /* SVABI/386 says I need this here */
24 long sem_pad3
[4]; /* SVABI/386 says I need this here */
28 struct ipc_perm sem_perm
; /* operation permission structure */
29 unsigned short sem_nsems
; /* number of semaphores in set */
30 int32_t sem_otime
; /* last semop() time */
31 int32_t sem_ctime
; /* last time changed by semctl() */
34 * These members are private and used only in the internal
35 * implementation of this interface.
37 struct __sem
*_sem_base
; /* pointer to first semaphore in set */
40 /* Warning: 64-bit structure padding is needed here */
41 struct semid_ds_sysctl50
{
42 struct ipc_perm_sysctl sem_perm
;
50 struct sem_sysctl_info50
{
51 struct seminfo seminfo
;
52 struct semid_ds_sysctl50 semids
[1];
56 static __inline
void __semid_ds14_to_native(const struct semid_ds14
*, struct semid_ds
*);
57 static __inline
void __native_to_semid_ds14(const struct semid_ds
*, struct semid_ds14
*);
58 static __inline
void __semid_ds13_to_native(const struct semid_ds13
*, struct semid_ds
*);
59 static __inline
void __native_to_semid_ds13(const struct semid_ds
*, struct semid_ds13
*);
62 __semid_ds13_to_native(const struct semid_ds13
*osembuf
, struct semid_ds
*sembuf
)
65 sembuf
->sem_perm
= osembuf
->sem_perm
;
67 #define CVT(x) sembuf->x = osembuf->x
75 __native_to_semid_ds13(const struct semid_ds
*sembuf
, struct semid_ds13
*osembuf
)
78 osembuf
->sem_perm
= sembuf
->sem_perm
;
80 #define CVT(x) osembuf->x = sembuf->x
81 #define CVTI(x) osembuf->x = (int)sembuf->x
90 __semid_ds14_to_native(const struct semid_ds14
*osembuf
, struct semid_ds
*sembuf
)
93 __ipc_perm14_to_native(&osembuf
->sem_perm
, &sembuf
->sem_perm
);
95 #define CVT(x) sembuf->x = osembuf->x
103 __native_to_semid_ds14(const struct semid_ds
*sembuf
, struct semid_ds14
*osembuf
)
106 __native_to_ipc_perm14(&sembuf
->sem_perm
, &osembuf
->sem_perm
);
108 #define CVT(x) osembuf->x = sembuf->x
109 #define CVTI(x) osembuf->x = (int)sembuf->x
117 int semctl(int, int, int, ...);
118 int __semctl(int, int, int, union __semun
*);
119 int __semctl13(int, int, int, ...);
120 int __semctl14(int, int, int, ...);
121 int __semctl50(int, int, int, ...);
122 int ____semctl50(int, int, int, ...);
125 #endif /* !_COMPAT_SYS_SEM_H_ */