FreeBSD syscall: fixes for semctl
commitd6abe92a9b97506fd9997dbbe7526c6e49884626
authorPaul Floyd <pjfloyd@wanadoo.fr>
Wed, 6 Mar 2024 20:19:23 +0000 (6 21:19 +0100)
committerPaul Floyd <pjfloyd@wanadoo.fr>
Wed, 6 Mar 2024 20:19:23 +0000 (6 21:19 +0100)
tree0a0b3888fc5591f51515f1052e809ad44a01ba61
parent3b90d5a2a563e4af13ed1cb8a253ff9859ca5780
FreeBSD syscall: fixes for semctl

On FreeBSD, the libc semctl function takes a union semun argument
for commands that take 4 arguments. It then gets that argument
via va_args and takes a pointer to it. That's what gets passed
to the sysctl - a pointer to union semun.

Previously we were handling the 4th argument as if it were
directly a union semun. This seems to have worked OK for years,
possibly due to luck concerning the way that va_args works
and/or the fact that the union is basically a union of
pointers. Recently I've been working on arm64 and there it
most definitely does not work.
coregrind/m_syswrap/syswrap-freebsd.c
coregrind/m_syswrap/syswrap-generic.c
include/vki/vki-freebsd.h
memcheck/tests/freebsd/scalar.c
memcheck/tests/freebsd/scalar.stderr.exp
memcheck/tests/freebsd/scalar.stderr.exp-x86