[PATCH] D29484: [XRay][compiler-rt] Use gettid instead of getpid in FDR mode.

Dean Michael Berris via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Sun Feb 5 17:59:45 PST 2017


This revision was automatically updated to reflect the committed changes.
Closed by commit rL294166: [XRay][compiler-rt] Use gettid instead of getpid in FDR mode. (authored by dberris).

Changed prior to commit:
  https://reviews.llvm.org/D29484?vs=86938&id=87175#toc

Repository:
  rL LLVM

https://reviews.llvm.org/D29484

Files:
  compiler-rt/trunk/lib/xray/xray_fdr_logging.cc


Index: compiler-rt/trunk/lib/xray/xray_fdr_logging.cc
===================================================================
--- compiler-rt/trunk/lib/xray/xray_fdr_logging.cc
+++ compiler-rt/trunk/lib/xray/xray_fdr_logging.cc
@@ -20,6 +20,7 @@
 #include <cassert>
 #include <cstring>
 #include <memory>
+#include <sys/syscall.h>
 #include <sys/time.h>
 #include <time.h>
 #include <unistd.h>
@@ -200,8 +201,8 @@
     auto &NewBuffer = *reinterpret_cast<MetadataRecord *>(&Records[0]);
     NewBuffer.Type = RecordType::Metadata;
     NewBuffer.RecordKind = MetadataRecord::RecordKinds::NewBuffer;
-    pid_t Pid = getpid();
-    std::memcpy(&NewBuffer.Data, &Pid, sizeof(pid_t));
+    pid_t Tid = syscall(SYS_gettid);
+    std::memcpy(&NewBuffer.Data, &Tid, sizeof(pid_t));
   }
 
   // Also write the WalltimeMarker record.


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D29484.87175.patch
Type: text/x-patch
Size: 823 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20170206/31d3d781/attachment.bin>


More information about the llvm-commits mailing list