kvm: Rename gettid() to build with glibc 2.30+
authorTommaso Marinelli <tommarin@ucm.es>
Wed, 2 Oct 2019 21:33:59 +0000 (23:33 +0200)
committerTommaso Marinelli <tommarin@ucm.es>
Fri, 4 Oct 2019 07:00:24 +0000 (07:00 +0000)
glibc 2.30 introduced the function gettid() in sys/types.h to return the
caller's thread ID. In order to avoid conflicts, the already present
gettid() functions have been renamed to sysGettid(). This fixes a
compilation error with X86 arch.

Change-Id: I76c971465fc4b50e4decde8303185439082b2378
Reviewed-on: https://gem5-review.googlesource.com/c/public/gem5/+/21379
Reviewed-by: Jason Lowe-Power <jason@lowepower.com>
Reviewed-by: Bobby R. Bruce <bbruce@ucdavis.edu>
Maintainer: Jason Lowe-Power <jason@lowepower.com>
Tested-by: kokoro <noreply+kokoro@google.com>
src/cpu/kvm/perfevent.cc
src/cpu/kvm/perfevent.hh
src/cpu/kvm/timer.cc

index 0b5960d5136f5dfae41ad23bf281aa5549150cd1..5a1c6126d5aee7c1afc3ff2146737f70e0d5a7b9 100644 (file)
@@ -186,7 +186,7 @@ PerfKvmCounter::attach(PerfKvmCounterConfig &config,
 }
 
 pid_t
-PerfKvmCounter::gettid()
+PerfKvmCounter::sysGettid()
 {
     return syscall(__NR_gettid);
 }
index b1b0da283d95336bbf164292c10a9bbe7b22dcfc..16a96864d2b549cd84e6742696fbc52cfce399c4 100644 (file)
@@ -297,7 +297,7 @@ public:
      *
      * @param signal Signal to send upon overflow
      */
-    void enableSignals(int signal) { enableSignals(gettid(), signal); }
+    void enableSignals(int signal) { enableSignals(sysGettid(), signal); }
 
 private:
     // Disallow copying
@@ -312,7 +312,7 @@ private:
      *
      * @return Current thread's TID
      */
-    pid_t gettid();
+    pid_t sysGettid();
 
     /**
      * MMAP the PerfEvent file descriptor.
index 8d3e69f423dbf09a6922c554ac9de8602bad74c7..22b19547d9d7d7516aa7caa550f801ef6d3c4cea 100644 (file)
@@ -61,7 +61,7 @@
 #endif
 
 static pid_t
-gettid()
+sysGettid()
 {
     return syscall(__NR_gettid);
 }
@@ -84,7 +84,7 @@ PosixKvmTimer::PosixKvmTimer(int signo, clockid_t clockID,
 
     sev.sigev_notify = SIGEV_THREAD_ID;
     sev.sigev_signo = signo;
-    sev.sigev_notify_thread_id = gettid();
+    sev.sigev_notify_thread_id = sysGettid();
     sev.sigev_value.sival_ptr = NULL;
 
     while (timer_create(clockID, &sev, &timer) == -1) {