bsd-user: Add semaphore operation constants and structures
Add System V semaphore operation constants (GETVAL, SETVAL, GETALL, etc.) and the target_sembuf and target_semun structures needed for semop(2) and semctl(2) syscall emulation. Signed-off-by: Stacey Son <sson@FreeBSD.org> Reviewed-by: Richard Henderson <richard.henderson@linaro.org> Signed-off-by: Warner Losh <imp@bsdimp.com>
Warner Losh committed
Feb 5, 2026 at 09:32 UTC
e9232a04eebf0e851330036ad226577360085d70
1 file changed
+20
bsd-user/syscall_defs.h
+20
@@ -93,6 +93,26 @@ struct bsd_shm_regions {
93
/*
94
* sys/sem.h
95
*/
96
+#define TARGET_GETNCNT 3 /* Return the value of semncnt {READ} */
97
+#define TARGET_GETPID 4 /* Return the value of sempid {READ} */
98
+#define TARGET_GETVAL 5 /* Return the value of semval {READ} */
99
+#define TARGET_GETALL 6 /* Return semvals into arg.array {READ} */
100
+#define TARGET_GETZCNT 7 /* Return the value of semzcnt {READ} */
101
+#define TARGET_SETVAL 8 /* Set the value of semval to arg.val {ALTER} */
102
+#define TARGET_SETALL 9 /* Set semvals from arg.array {ALTER} */
103
+
104
+struct target_sembuf {
105
+ abi_ushort sem_num; /* semaphore # */
106
+ abi_short sem_op; /* semaphore operation */
107
+ abi_short sem_flg; /* operation flags */
108
+};
109
+
110
+union target_semun {
111
+ abi_int val; /* value for SETVAL */
112
+ abi_ulong buf; /* buffer for IPC_STAT & IPC_SET */
113
+ abi_ulong array; /* array for GETALL & SETALL */
114
+};
115
+
116
struct target_semid_ds {
117
struct target_ipc_perm sem_perm; /* operation permission struct */
118
abi_ptr sem_base; /* pointer to first semaphore in set */