diff options
author | Ilya Leoshkevich <iii@linux.ibm.com> | 2024-03-05 12:09:42 +0000 |
---|---|---|
committer | Alex Bennée <alex.bennee@linaro.org> | 2024-03-06 12:35:19 +0000 |
commit | 4edc98fcc8c8124a2e345144a75e1b33dac7632c (patch) | |
tree | 87c6ae410460575cf92ea62a552302488374eec9 /bsd-user | |
parent | 3d6ed98da82e0bb2384bfbc83fadb518271fdbca (diff) |
{linux,bsd}-user: Pass pid to fork_end()
The upcoming follow-fork-mode child support requires knowing the child
pid. Pass it down.
Reviewed-by: Alex Bennée <alex.bennee@linaro.org>
Reviewed-by: Richard Henderson <richard.henderson@linaro.org>
Signed-off-by: Ilya Leoshkevich <iii@linux.ibm.com>
Message-Id: <20240219141628.246823-6-iii@linux.ibm.com>
Signed-off-by: Alex Bennée <alex.bennee@linaro.org>
Message-Id: <20240305121005.3528075-7-alex.bennee@linaro.org>
Diffstat (limited to 'bsd-user')
-rw-r--r-- | bsd-user/freebsd/os-proc.h | 6 | ||||
-rw-r--r-- | bsd-user/main.c | 4 | ||||
-rw-r--r-- | bsd-user/qemu.h | 2 |
3 files changed, 7 insertions, 5 deletions
diff --git a/bsd-user/freebsd/os-proc.h b/bsd-user/freebsd/os-proc.h index d641878034..3003c8cb63 100644 --- a/bsd-user/freebsd/os-proc.h +++ b/bsd-user/freebsd/os-proc.h @@ -208,7 +208,7 @@ static inline abi_long do_freebsd_fork(void *cpu_env) */ set_second_rval(cpu_env, child_flag); - fork_end(child_flag); + fork_end(ret); return ret; } @@ -252,7 +252,7 @@ static inline abi_long do_freebsd_rfork(void *cpu_env, abi_long flags) * value: 0 for parent process, 1 for child process. */ set_second_rval(cpu_env, child_flag); - fork_end(child_flag); + fork_end(ret); return ret; @@ -285,7 +285,7 @@ static inline abi_long do_freebsd_pdfork(void *cpu_env, abi_ulong target_fdp, * value: 0 for parent process, 1 for child process. */ set_second_rval(cpu_env, child_flag); - fork_end(child_flag); + fork_end(ret); return ret; } diff --git a/bsd-user/main.c b/bsd-user/main.c index 517c6b3ec2..fca9b30204 100644 --- a/bsd-user/main.c +++ b/bsd-user/main.c @@ -116,8 +116,10 @@ void fork_start(void) gdbserver_fork_start(); } -void fork_end(int child) +void fork_end(pid_t pid) { + bool child = pid == 0; + if (child) { CPUState *cpu, *next_cpu; /* diff --git a/bsd-user/qemu.h b/bsd-user/qemu.h index 4adb75d19f..1b0a591d2d 100644 --- a/bsd-user/qemu.h +++ b/bsd-user/qemu.h @@ -192,7 +192,7 @@ void cpu_loop(CPUArchState *env); char *target_strerror(int err); int get_osversion(void); void fork_start(void); -void fork_end(int child); +void fork_end(pid_t pid); #include "qemu/log.h" |