Skip to content

Commit 23b58bb

Browse files
authored
Merge pull request n64decomp#2 from queueRAM/sys_gettid
linux-user: rename gettid() to sys_gettid() to avoid clash with glibc
2 parents 32ab296 + 939acda commit 23b58bb

File tree

1 file changed

+7
-13
lines changed

1 file changed

+7
-13
lines changed

linux-user/syscall.c

Lines changed: 7 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -259,15 +259,9 @@ static inline type name (type1 arg1,type2 arg2,type3 arg3,type4 arg4,type5 arg5,
259259
#define TARGET_NR__llseek TARGET_NR_llseek
260260
#endif
261261

262-
#ifdef __NR_gettid
263-
_syscall0(int, gettid)
264-
#else
265-
/* This is a replacement for the host gettid() and must return a host
266-
errno. */
267-
static int gettid(void) {
268-
return -ENOSYS;
269-
}
270-
#endif
262+
#define __NR_sys_gettid __NR_gettid
263+
_syscall0(int, sys_gettid)
264+
271265
#if defined(TARGET_NR_getdents) && defined(__NR_getdents)
272266
_syscall3(int, sys_getdents, uint, fd, struct linux_dirent *, dirp, uint, count);
273267
#endif
@@ -6448,7 +6442,7 @@ static void *clone_func(void *arg)
64486442
cpu = ENV_GET_CPU(env);
64496443
thread_cpu = cpu;
64506444
ts = (TaskState *)cpu->opaque;
6451-
info->tid = gettid();
6445+
info->tid = sys_gettid();
64526446
task_settid(ts);
64536447
#ifdef TARGET_ABI_IRIX
64546448
/* TODO: which fields in the PRDA are filled in by the IRIX kernel? */
@@ -6610,9 +6604,9 @@ static int do_fork(CPUArchState *env, unsigned int flags, abi_ulong newsp,
66106604
mapping. We can't repeat the spinlock hack used above because
66116605
the child process gets its own copy of the lock. */
66126606
if (flags & CLONE_CHILD_SETTID)
6613-
put_user_u32(gettid(), child_tidptr);
6607+
put_user_u32(sys_gettid(), child_tidptr);
66146608
if (flags & CLONE_PARENT_SETTID)
6615-
put_user_u32(gettid(), parent_tidptr);
6609+
put_user_u32(sys_gettid(), parent_tidptr);
66166610
if (flags & CLONE_SETTLS)
66176611
cpu_set_tls (env, newtls);
66186612
if (flags & CLONE_CHILD_CLEARTID)
@@ -12589,7 +12583,7 @@ abi_long do_syscall(void *cpu_env, int num, abi_long arg1,
1258912583
#endif
1259012584
#ifdef TARGET_NR_gettid
1259112585
case TARGET_NR_gettid:
12592-
ret = get_errno(gettid());
12586+
ret = get_errno(sys_gettid());
1259312587
break;
1259412588
#endif
1259512589
#ifdef TARGET_NR_readahead

0 commit comments

Comments
 (0)