bsd-user: Implement System V semaphore calls
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 <sson@FreeBSD.org> Reviewed-by: Richard Henderson <richard.henderson@linaro.org> Signed-off-by: Warner Losh <imp@bsdimp.com>
Stacey Son committed
Feb 5, 2026 at 09:34 UTC
4019112cf164e36616972d639e9432dea2824b1e
1 file changed
+16
bsd-user/freebsd/os-syscall.c
+16
@@ -36,6 +36,7 @@
36
#include "bsd-file.h"
37
#include "bsd-mem.h"
38
#include "bsd-proc.h"
39
+#include "bsd-misc.h"
40
41
/* BSD dependent syscall shims */
42
#include "os-stat.h"
@@ -878,6 +879,21 @@ static abi_long freebsd_syscall(void *cpu_env, int num, abi_long arg1,
879
ret = do_bsd_shmdt(arg1);
880
break;
881
882
+ /*
883
+ * System V Semaphores
884
+ */
885
+ case TARGET_FREEBSD_NR_semget: /* semget(2) */
886
+ ret = do_bsd_semget(arg1, arg2, arg3);
887
+ break;
888
+
889
+ case TARGET_FREEBSD_NR_semop: /* semop(2) */
890
+ ret = do_bsd_semop(arg1, arg2, arg3);
891
+ break;
892
+
893
+ case TARGET_FREEBSD_NR___semctl: { /* __semctl() undocumented */
894
+ ret = do_bsd___semctl(arg1, arg2, arg3, arg4);
895
+ break;
896
+ }
897
case TARGET_FREEBSD_NR_freebsd11_vadvise:
898
ret = do_bsd_vadvise();
899
break;