diff options
author | Alan Coopersmith <alan.coopersmith@oracle.com> | 2014-12-23 19:07:10 -0800 |
---|---|---|
committer | Daniel Vetter <daniel.vetter@ffwll.ch> | 2015-01-06 09:29:45 +0100 |
commit | 99e6defbe79d3a41f967b55d33ce1a856914e797 (patch) | |
tree | 7d436f9a788bfd652a3a63714dcbd481e487ec4d /tests | |
parent | cf93bc8df9f5f94a0aedc8b52bad0ad4e036737c (diff) |
Use pthread calls instead of raw syscalls on non-Linux systems
Raw system calls aren't portable to other kernels.
Signed-off-by: Alan Coopersmith <alan.coopersmith@oracle.com>
Signed-off-by: Daniel Vetter <daniel.vetter@ffwll.ch>
Diffstat (limited to 'tests')
-rw-r--r-- | tests/core_get_client_auth.c | 8 | ||||
-rw-r--r-- | tests/drm_import_export.c | 4 |
2 files changed, 11 insertions, 1 deletions
diff --git a/tests/core_get_client_auth.c b/tests/core_get_client_auth.c index eef97e02..bbfdddf4 100644 --- a/tests/core_get_client_auth.c +++ b/tests/core_get_client_auth.c @@ -37,7 +37,11 @@ #include <stdlib.h> #include <stdio.h> #include <string.h> +#ifdef __linux__ # include <sys/syscall.h> +#else +# include <pthread.h> +#endif #include "drm.h" #include "ioctl_wrappers.h" @@ -47,7 +51,9 @@ static bool is_local_tid(pid_t tid) { -#ifndef ANDROID +#ifndef __linux__ + return pthread_self() == tid; +#elif !defined(ANDROID) /* On Linux systems, drmGetClient() would return the thread ID instead of the actual process ID */ return syscall(SYS_gettid) == tid; diff --git a/tests/drm_import_export.c b/tests/drm_import_export.c index 83e753bf..57b13ddb 100644 --- a/tests/drm_import_export.c +++ b/tests/drm_import_export.c @@ -121,7 +121,11 @@ static void start_test(void) static void * test_thread(void * par) { +#ifdef __linux__ igt_debug("start %ld\n", syscall(SYS_gettid)); +#else + igt_debug("start %ld\n", (long) pthread_self()); +#endif start_test(); return NULL; |