diff mbox series

[v4,03/12] {linux,bsd}-user: Update ts_tid after fork()

Message ID 20240219141628.246823-4-iii@linux.ibm.com
State New
Headers show
Series gdbstub: Implement follow-fork-mode child | expand

Commit Message

Ilya Leoshkevich Feb. 19, 2024, 2:15 p.m. UTC
Currently ts_tid contains the parent tid after fork(), which is not
correct. So far it has not affected anything, but the upcoming
follow-fork-mode child support relies on the correct value, so fix it.

Reviewed-by: Alex Bennée <alex.bennee@linaro.org>
Signed-off-by: Ilya Leoshkevich <iii@linux.ibm.com>
---
 bsd-user/main.c   | 1 +
 linux-user/main.c | 1 +
 2 files changed, 2 insertions(+)

Comments

Warner Losh Feb. 19, 2024, 2:33 p.m. UTC | #1
On Mon, Feb 19, 2024 at 7:22 AM Ilya Leoshkevich <iii@linux.ibm.com> wrote:

> Currently ts_tid contains the parent tid after fork(), which is not
> correct. So far it has not affected anything, but the upcoming
> follow-fork-mode child support relies on the correct value, so fix it.
>
> Reviewed-by: Alex Bennée <alex.bennee@linaro.org>
> Signed-off-by: Ilya Leoshkevich <iii@linux.ibm.com>
>

Reviewed-by: Warner Losh <imp@bsdimp.com>

Warner


> ---
>  bsd-user/main.c   | 1 +
>  linux-user/main.c | 1 +
>  2 files changed, 2 insertions(+)
>
> diff --git a/bsd-user/main.c b/bsd-user/main.c
> index e5efb7b8458..72289673a94 100644
> --- a/bsd-user/main.c
> +++ b/bsd-user/main.c
> @@ -127,6 +127,7 @@ void fork_end(int child)
>           * state, so we don't need to end_exclusive() here.
>           */
>          qemu_init_cpu_list();
> +        get_task_state(thread_cpu)->ts_tid = qemu_get_thread_id();
>          gdbserver_fork(thread_cpu);
>      } else {
>          mmap_fork_end(child);
> diff --git a/linux-user/main.c b/linux-user/main.c
> index 74b2fbb3938..1d53f708354 100644
> --- a/linux-user/main.c
> +++ b/linux-user/main.c
> @@ -160,6 +160,7 @@ void fork_end(int child)
>              }
>          }
>          qemu_init_cpu_list();
> +        get_task_state(thread_cpu)->ts_tid = qemu_get_thread_id();
>          gdbserver_fork(thread_cpu);
>      } else {
>          cpu_list_unlock();
> --
> 2.43.2
>
>
diff mbox series

Patch

diff --git a/bsd-user/main.c b/bsd-user/main.c
index e5efb7b8458..72289673a94 100644
--- a/bsd-user/main.c
+++ b/bsd-user/main.c
@@ -127,6 +127,7 @@  void fork_end(int child)
          * state, so we don't need to end_exclusive() here.
          */
         qemu_init_cpu_list();
+        get_task_state(thread_cpu)->ts_tid = qemu_get_thread_id();
         gdbserver_fork(thread_cpu);
     } else {
         mmap_fork_end(child);
diff --git a/linux-user/main.c b/linux-user/main.c
index 74b2fbb3938..1d53f708354 100644
--- a/linux-user/main.c
+++ b/linux-user/main.c
@@ -160,6 +160,7 @@  void fork_end(int child)
             }
         }
         qemu_init_cpu_list();
+        get_task_state(thread_cpu)->ts_tid = qemu_get_thread_id();
         gdbserver_fork(thread_cpu);
     } else {
         cpu_list_unlock();