1 --- qemu-2.10.0-clean/linux-user/syscall.c 2020-03-12 18:47:47.898592169 +0100
2 +++ qemu-2.10.0/linux-user/syscall.c 2020-03-13 09:13:42.461809699 +0100
4 #include <sys/resource.h>
6 #include <linux/capability.h>
7 +#include <linux/sockios.h> // https://lkml.org/lkml/2019/6/3/988
11 @@ -256,7 +257,9 @@ static type name (type1 arg1,type2 arg2,
15 -_syscall0(int, gettid)
16 +// taken from https://patchwork.kernel.org/patch/10862231/
17 +#define __NR_sys_gettid __NR_gettid
18 +_syscall0(int, sys_gettid)
20 /* This is a replacement for the host gettid() and must return a host
22 @@ -6219,7 +6222,7 @@ static void *clone_func(void *arg)
23 cpu = ENV_GET_CPU(env);
25 ts = (TaskState *)cpu->opaque;
26 - info->tid = gettid();
27 + info->tid = sys_gettid();
29 if (info->child_tidptr)
30 put_user_u32(info->tid, info->child_tidptr);
31 @@ -6363,9 +6366,9 @@ static int do_fork(CPUArchState *env, un
32 mapping. We can't repeat the spinlock hack used above because
33 the child process gets its own copy of the lock. */
34 if (flags & CLONE_CHILD_SETTID)
35 - put_user_u32(gettid(), child_tidptr);
36 + put_user_u32(sys_gettid(), child_tidptr);
37 if (flags & CLONE_PARENT_SETTID)
38 - put_user_u32(gettid(), parent_tidptr);
39 + put_user_u32(sys_gettid(), parent_tidptr);
40 ts = (TaskState *)cpu->opaque;
41 if (flags & CLONE_SETTLS)
42 cpu_set_tls (env, newtls);
43 @@ -11402,7 +11405,7 @@ abi_long do_syscall(void *cpu_env, int n
46 case TARGET_NR_gettid:
47 - ret = get_errno(gettid());
48 + ret = get_errno(sys_gettid());
50 #ifdef TARGET_NR_readahead
51 case TARGET_NR_readahead: