aboutsummaryrefslogtreecommitdiffstats
path: root/src/libstrongswan
diff options
context:
space:
mode:
authorTobias Brunner <tobias@strongswan.org>2012-01-10 18:31:33 +0100
committerTobias Brunner <tobias@strongswan.org>2012-01-10 18:31:33 +0100
commit66f16d9629b08fb2af4f2eac8ca18c1b95b07877 (patch)
treefdc6ef5506a2e26256dab8edce7fd2ab210d7711 /src/libstrongswan
parent190cd8a475ee099b4e8fe6459556f2a0fecb2d7c (diff)
downloadstrongswan-66f16d9629b08fb2af4f2eac8ca18c1b95b07877.tar.bz2
strongswan-66f16d9629b08fb2af4f2eac8ca18c1b95b07877.tar.xz
Use native gettid() if available (which is the case on Android).
Diffstat (limited to 'src/libstrongswan')
-rw-r--r--src/libstrongswan/threading/thread.c14
1 files changed, 11 insertions, 3 deletions
diff --git a/src/libstrongswan/threading/thread.c b/src/libstrongswan/threading/thread.c
index 9092bf7b7..0cbd97c3f 100644
--- a/src/libstrongswan/threading/thread.c
+++ b/src/libstrongswan/threading/thread.c
@@ -1,5 +1,5 @@
/*
- * Copyright (C) 2009-2011 Tobias Brunner
+ * Copyright (C) 2009-2012 Tobias Brunner
* Hochschule fuer Technik Rapperswil
*
* This program is free software; you can redistribute it and/or modify it
@@ -17,10 +17,18 @@
#include <pthread.h>
#include <signal.h>
#include <semaphore.h>
+
#ifdef HAVE_GETTID
+#include <sys/types.h>
+#elif defined(HAVE_SYS_GETTID)
#include <unistd.h>
#include <sys/syscall.h>
-#endif
+static inline pid_t gettid()
+{
+ return syscall(SYS_gettid);
+}
+#define HAVE_GETTID
+#endif /* HAVE_SYS_GETTID */
#include <library.h>
#include <debug.h>
@@ -287,7 +295,7 @@ static void *thread_main(private_thread_t *this)
* could be of any size, or even a struct) */
#ifdef HAVE_GETTID
DBG2(DBG_LIB, "created thread %.2d [%u]",
- this->id, syscall(SYS_gettid));
+ this->id, gettid());
#else
DBG2(DBG_LIB, "created thread %.2d [%lx]",
this->id, (u_long)this->thread_id);