[PATCH] D56937: [safestack] Add ThreadId type as uint64_t
Vitaly Buka via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Fri Jan 18 14:36:21 PST 2019
This revision was automatically updated to reflect the committed changes.
Closed by commit rL351607: [safestack] Add ThreadId type as uint64_t (authored by vitalybuka, committed by ).
Herald added a subscriber: delcypher.
Changed prior to commit:
https://reviews.llvm.org/D56937?vs=182612&id=182614#toc
Repository:
rL LLVM
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D56937/new/
https://reviews.llvm.org/D56937
Files:
compiler-rt/trunk/lib/safestack/safestack.cc
compiler-rt/trunk/lib/safestack/safestack_platform.h
Index: compiler-rt/trunk/lib/safestack/safestack_platform.h
===================================================================
--- compiler-rt/trunk/lib/safestack/safestack_platform.h
+++ compiler-rt/trunk/lib/safestack/safestack_platform.h
@@ -16,13 +16,20 @@
#include "sanitizer_common/sanitizer_platform.h"
+#include <stdint.h>
#include <sys/syscall.h>
#include <sys/types.h>
#include <unistd.h>
+#if SANITIZER_NETBSD
+#include <lwp.h>
+#endif
+
namespace safestack {
-inline pid_t GetTid() {
+using ThreadId = uint64_t;
+
+inline ThreadId GetTid() {
#if SANITIZER_NETBSD
return _lwp_self();
#elif SANITIZER_FREEBSD
@@ -38,7 +45,7 @@
#endif
}
-inline int TgKill(pid_t pid, pid_t tid, int sig) {
+inline int TgKill(pid_t pid, ThreadId tid, int sig) {
#if SANITIZER_NETBSD
(void)pid;
return _lwp_kill(tid, sig);
Index: compiler-rt/trunk/lib/safestack/safestack.cc
===================================================================
--- compiler-rt/trunk/lib/safestack/safestack.cc
+++ compiler-rt/trunk/lib/safestack/safestack.cc
@@ -151,7 +151,7 @@
void *stack_base;
size_t size;
pid_t pid;
- pid_t tid;
+ ThreadId tid;
};
/// Linked list of unsafe stacks for threads that are exiting. We delay
@@ -174,7 +174,7 @@
pthread_mutex_unlock(&thread_stacks_mutex);
pid_t pid = getpid();
- pid_t tid = GetTid();
+ ThreadId tid = GetTid();
// Free stacks for dead threads
thread_stack_ll **stackp = &temp_stacks;
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D56937.182614.patch
Type: text/x-patch
Size: 1470 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20190118/ae326aaf/attachment.bin>
More information about the llvm-commits
mailing list