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>
This commit is contained in:
Warner Losh
2026-02-05 09:32:11 -07:00
parent e2ad4ba061
commit e9232a04ee

View File

@@ -93,6 +93,26 @@ struct bsd_shm_regions {
/*
* sys/sem.h
*/
#define TARGET_GETNCNT 3 /* Return the value of semncnt {READ} */
#define TARGET_GETPID 4 /* Return the value of sempid {READ} */
#define TARGET_GETVAL 5 /* Return the value of semval {READ} */
#define TARGET_GETALL 6 /* Return semvals into arg.array {READ} */
#define TARGET_GETZCNT 7 /* Return the value of semzcnt {READ} */
#define TARGET_SETVAL 8 /* Set the value of semval to arg.val {ALTER} */
#define TARGET_SETALL 9 /* Set semvals from arg.array {ALTER} */
struct target_sembuf {
abi_ushort sem_num; /* semaphore # */
abi_short sem_op; /* semaphore operation */
abi_short sem_flg; /* operation flags */
};
union target_semun {
abi_int val; /* value for SETVAL */
abi_ulong buf; /* buffer for IPC_STAT & IPC_SET */
abi_ulong array; /* array for GETALL & SETALL */
};
struct target_semid_ds {
struct target_ipc_perm sem_perm; /* operation permission struct */
abi_ptr sem_base; /* pointer to first semaphore in set */