diff mbox series

[v2,049/108] linux-user: Fix stub gettid

Message ID 20180610030220.3777-50-richard.henderson@linaro.org
State New
Headers show
Series [v2,001/108] linux-user: Remove DEBUG | expand

Commit Message

Richard Henderson June 10, 2018, 3:01 a.m. UTC
A "proper" implementation of the stub would assign ENOSYS to
errno and return -1.  As it is, the subsequent get_error will
return whatever garbage value was in errno.

Use the bogus syscall method for defining the stub function.

Signed-off-by: Richard Henderson <richard.henderson@linaro.org>
---
 linux-user/syscall.c | 13 ++++---------
 1 file changed, 4 insertions(+), 9 deletions(-)
diff mbox series

Patch

diff --git a/linux-user/syscall.c b/linux-user/syscall.c
index 4dc2312ae6..46c7c485fd 100644
--- a/linux-user/syscall.c
+++ b/linux-user/syscall.c
@@ -256,17 +256,12 @@  static type name (type1 arg1,type2 arg2,type3 arg3,type4 arg4,type5 arg5,	\
 #ifndef __NR_getrandom
 #define __NR_getrandom  -1
 #endif
-
-#ifdef __NR_gettid
-_syscall0(int, gettid)
-#else
-/* This is a replacement for the host gettid() and must return a host
-   errno. */
-static int gettid(void) {
-    return -ENOSYS;
-}
+#ifndef __NR_gettid
+#define __NR_gettid  -1
 #endif
 
+_syscall0(int, gettid)
+
 /* For the 64-bit guest on 32-bit host case we must emulate
  * getdents using getdents64, because otherwise the host
  * might hand us back more dirent records than we can fit