Expand PMF_FN_* macros.
[netbsd-mini2440.git] / sys / compat / sys / sem.h
blobbe0573b5923a31f406a6d718b7fff286659fae53
1 /* $NetBSD: sem.h,v 1.5 2009/01/11 02:45:50 christos Exp $ */
3 /*
4 * SVID compatible sem.h file
6 * Author: Daniel Boulet
7 */
9 #ifndef _COMPAT_SYS_SEM_H_
10 #define _COMPAT_SYS_SEM_H_
12 #include <compat/sys/ipc.h>
14 struct semid_ds14 {
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 */
27 struct semid_ds13 {
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;
43 int16_t sem_nsems;
44 int16_t pad2;
45 int32_t pad3;
46 int32_t sem_otime;
47 int32_t sem_ctime;
50 struct sem_sysctl_info50 {
51 struct seminfo seminfo;
52 struct semid_ds_sysctl50 semids[1];
55 __BEGIN_DECLS
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 *);
61 static __inline void
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
68 CVT(sem_nsems);
69 CVT(sem_otime);
70 CVT(sem_ctime);
71 #undef CVT
74 static __inline void
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
82 CVT(sem_nsems);
83 CVTI(sem_otime);
84 CVTI(sem_ctime);
85 #undef CVT
86 #undef CVTI
89 static __inline void
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
96 CVT(sem_nsems);
97 CVT(sem_otime);
98 CVT(sem_ctime);
99 #undef CVT
102 static __inline void
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
110 CVT(sem_nsems);
111 CVTI(sem_otime);
112 CVTI(sem_ctime);
113 #undef CVT
114 #undef CVTI
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, ...);
123 __END_DECLS
125 #endif /* !_COMPAT_SYS_SEM_H_ */