bsd-user: Implement wait4(2) and wait6(2) system calls.

Signed-off-by: Stacey Son <sson@FreeBSD.org>
Signed-off-by: Karim Taha <kariem.taha2.7@gmail.com>
Reviewed-by: Warner Losh <imp@bsdimp.com>
Message-Id: <20230925182425.3163-24-kariem.taha2.7@gmail.com>
This commit is contained in:
Stacey Son 2023-09-25 21:24:20 +03:00 committed by Warner Losh
parent 36999e6a6b
commit ae502887cb
2 changed files with 99 additions and 0 deletions

View file

@ -40,6 +40,12 @@
#include "os-stat.h"
#include "os-proc.h"
/* used in os-proc */
safe_syscall4(pid_t, wait4, pid_t, wpid, int *, status, int, options,
struct rusage *, rusage);
safe_syscall6(pid_t, wait6, idtype_t, idtype, id_t, id, int *, status, int,
options, struct __wrusage *, wrusage, siginfo_t *, infop);
/* I/O */
safe_syscall3(int, open, const char *, path, int, flags, mode_t, mode);
safe_syscall4(int, openat, int, fd, const char *, path, int, flags, mode_t,
@ -228,6 +234,15 @@ static abi_long freebsd_syscall(void *cpu_env, int num, abi_long arg1,
ret = do_freebsd_fexecve(arg1, arg2, arg3);
break;
case TARGET_FREEBSD_NR_wait4: /* wait4(2) */
ret = do_freebsd_wait4(arg1, arg2, arg3, arg4);
break;
case TARGET_FREEBSD_NR_wait6: /* wait6(2) */
ret = do_freebsd_wait6(cpu_env, arg1, arg2, arg3,
arg4, arg5, arg6, arg7, arg8);
break;
case TARGET_FREEBSD_NR_exit: /* exit(2) */
ret = do_bsd_exit(cpu_env, arg1);
break;