summaryrefslogtreecommitdiff
blob: 77e63e3de7efa0a6ce991b887c1370d215c4a7fa (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
From b520d58d00b7ed6c5cc9bc97c62f07e09f4f49ad Mon Sep 17 00:00:00 2001
From: Samy Al Bahra <sbahra@backtrace.io>
Date: Tue, 29 Oct 2019 17:30:09 -0400
Subject: [PATCH] regressions/common: rename gettid wrapper to common_gettid.

glibc-2.30 added a wrapper to gettid (https://lwn.net/Articles/795127/).
gettid will clash with the glibc-provided symbol. Remove the
macro and instead move to a dedicated namespace.

We go this route to avoid introducing unnecessary complexity to
build.

Fixes #147
---
 regressions/common.h | 8 +++-----
 1 file changed, 3 insertions(+), 5 deletions(-)

diff --git a/regressions/common.h b/regressions/common.h
index 6e53483d..9cdc690a 100644
--- a/regressions/common.h
+++ b/regressions/common.h
@@ -267,13 +267,11 @@ struct affinity {
 #define AFFINITY_INITIALIZER {0, 0}
 
 #ifdef __linux__
-#ifndef gettid
 static pid_t
-gettid(void)
+common_gettid(void)
 {
 	return syscall(__NR_gettid);
 }
-#endif /* gettid */
 
 CK_CC_UNUSED static int
 aff_iterate(struct affinity *acb)
@@ -285,7 +283,7 @@ aff_iterate(struct affinity *acb)
 	CPU_ZERO(&s);
 	CPU_SET(c % CORES, &s);
 
-	if (sched_setaffinity(gettid(), sizeof(s), &s) != 0)
+	if (sched_setaffinity(common_gettid(), sizeof(s), &s) != 0)
 		perror("WARNING: Could not affine thread");
 	
         return 0;
@@ -300,7 +298,7 @@ aff_iterate_core(struct affinity *acb, unsigned int *core)
 	CPU_ZERO(&s);
 	CPU_SET((*core) % CORES, &s);
 
-	if (sched_setaffinity(gettid(), sizeof(s), &s) != 0)
+	if (sched_setaffinity(common_gettid(), sizeof(s), &s) != 0)
 		perror("WARNING: Could not affine thread");
 	
         return 0;