On 8/27/23 08:57, Karim Taha wrote:
From: Stacey Son <s...@freebsd.org>

Signed-off-by: Stacey Son <s...@freebsd.org>
Signed-off-by: Karim Taha <kariem.taha...@gmail.com>
---
  bsd-user/freebsd/os-proc.h    | 32 ++++++++++++++++++++++++++++++++
  bsd-user/freebsd/os-syscall.c |  4 ++++
  2 files changed, 36 insertions(+)

diff --git a/bsd-user/freebsd/os-proc.h b/bsd-user/freebsd/os-proc.h
index 94824d737a..1eaba908a5 100644
--- a/bsd-user/freebsd/os-proc.h
+++ b/bsd-user/freebsd/os-proc.h
@@ -248,4 +248,36 @@ static inline abi_long do_freebsd_rfork(void *cpu_env, 
abi_long flags)
} +/* pdfork(2) */
+static inline abi_long do_freebsd_pdfork(void *cpu_env, abi_ulong target_fdp,
+        abi_long flags)
+{
+    abi_long ret;
+    abi_ulong child_flag;
+    int fd;
+
+    fork_start();
+    ret = pdfork(&fd, flags);
+    if (ret == 0) {
+        /* child */
+        child_flag = 1;
+        target_cpu_clone_regs(cpu_env, 0);
+    } else {
+        /* parent */
+        child_flag = 0;
+    }
+    if (put_user_s32(fd, target_fdp)) {
+        return -TARGET_EFAULT;
+    }

I *think* this copy belongs in the parent? It's really hard to follow the path of new process creation within the freebsd kernel.

Anyway, the rest looks fine so I'll give an

Acked-by: Richard Henderson <richard.hender...@linaro.org>


r~

Reply via email to