On Thu, Feb 5, 2026 at 7:48 PM Richard Henderson <
richard.henderson@linaro.org> wrote:
> On 2/6/26 03:26, Warner Losh wrote:
> > 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>
> > Signed-off-by: Warner Losh <imp@bsdimp.com>
> > ---
> > bsd-user/syscall_defs.h | 20 ++++++++++++++++++++
> > 1 file changed, 20 insertions(+)
> >
> > diff --git a/bsd-user/syscall_defs.h b/bsd-user/syscall_defs.h
> > index 62b9bc752b..becd04efb4 100644
> > --- a/bsd-user/syscall_defs.h
> > +++ b/bsd-user/syscall_defs.h
> > @@ -95,6 +95,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 {
> > + unsigned short sem_num; /* semaphore # */
> > + short sem_op; /* semaphore operation */
> > + short sem_flg; /* operation flags */
> > +};
>
> abi_short, abi_ushort.
>
> > +
> > +union target_semun {
> > + int val; /* value for SETVAL */
>
> abi_int.
>
> > + abi_ulong buf; /* buffer for IPC_STAT & IPC_SET */
> > + abi_ulong array; /* array for GETALL & SETALL */
>
> abi_ptr.
>
Agreed.