On 2/6/26 03:26, Warner Losh wrote:
From: Stacey Son <[email protected]>
Wire up semget(2) and semop(2) syscalls to get System V semaphore
implementation, as well the undocumented __semctl used to implement the
bits of the interface in libc.
Signed-off-by: Stacey Son <[email protected]>
Signed-off-by: Warner Losh <[email protected]>
---
bsd-user/freebsd/os-syscall.c | 23 +++++++++++++++++++++++
1 file changed, 23 insertions(+)
diff --git a/bsd-user/freebsd/os-syscall.c b/bsd-user/freebsd/os-syscall.c
index ca2f6fdb66..6e38007bdd 100644
--- a/bsd-user/freebsd/os-syscall.c
+++ b/bsd-user/freebsd/os-syscall.c
@@ -37,6 +37,7 @@
#include "bsd-file.h"
#include "bsd-mem.h"
#include "bsd-proc.h"
+#include "bsd-misc.h"
/* BSD dependent syscall shims */
#include "os-stat.h"
@@ -879,6 +880,28 @@ static abi_long freebsd_syscall(void *cpu_env, int num,
abi_long arg1,
ret = do_bsd_shmdt(arg1);
break;
+ /*
+ * System V Semaphores
+ */
+ case TARGET_FREEBSD_NR_semget: /* semget(2) */
+ ret = do_bsd_semget(arg1, arg2, arg3);
+ break;
+
+ case TARGET_FREEBSD_NR_semop: /* semop(2) */
+ ret = do_bsd_semop(arg1, arg2, arg3);
+ break;
+
+ case TARGET_FREEBSD_NR___semctl: { /* __semctl() undocumented */
+ /*
+ * The semun argument to semctl is passed by value, so dereference the
+ * ptr argument.
+ */
+ abi_ulong atptr;
+ get_user_ual(atptr, (abi_ulong)arg4);
+ ret = do_bsd___semctl(arg1, arg2, arg3,
+ (union target_semun)(abi_ulong) atptr);
Eh? Does this really compile, casting an integer to a union?
Something seems very confused here.
r~