提交 8df34c56 编写于 作者: M Mathieu Desnoyers 提交者: Shuah Khan

rseq/selftests: Fix: Namespace gettid() for compatibility with glibc 2.30

glibc 2.30 introduces gettid() in public headers, which clashes with
the internal static definition within rseq selftests.

Rename gettid() to rseq_gettid() to eliminate this symbol name clash.
Reported-by: NTommi T. Rantala <tommi.t.rantala@nokia.com>
Signed-off-by: NMathieu Desnoyers <mathieu.desnoyers@efficios.com>
Cc: Shuah Khan <skhan@linuxfoundation.org>
Cc: Tommi T. Rantala <tommi.t.rantala@nokia.com>
Cc: Thomas Gleixner <tglx@linutronix.de>
Cc: Peter Zijlstra (Intel) <peterz@infradead.org>
Cc: "Paul E. McKenney" <paulmck@linux.ibm.com>
Cc: Boqun Feng <boqun.feng@gmail.com>
Cc: "H . Peter Anvin" <hpa@zytor.com>
Cc: Paul Turner <pjt@google.com>
Cc: Dmitry Vyukov <dvyukov@google.com>
Cc: <stable@vger.kernel.org>	# v4.18+
Signed-off-by: NShuah Khan <skhan@linuxfoundation.org>
上级 af9cb29c
...@@ -15,7 +15,7 @@ ...@@ -15,7 +15,7 @@
#include <errno.h> #include <errno.h>
#include <stddef.h> #include <stddef.h>
static inline pid_t gettid(void) static inline pid_t rseq_gettid(void)
{ {
return syscall(__NR_gettid); return syscall(__NR_gettid);
} }
...@@ -373,11 +373,12 @@ void *test_percpu_spinlock_thread(void *arg) ...@@ -373,11 +373,12 @@ void *test_percpu_spinlock_thread(void *arg)
rseq_percpu_unlock(&data->lock, cpu); rseq_percpu_unlock(&data->lock, cpu);
#ifndef BENCHMARK #ifndef BENCHMARK
if (i != 0 && !(i % (reps / 10))) if (i != 0 && !(i % (reps / 10)))
printf_verbose("tid %d: count %lld\n", (int) gettid(), i); printf_verbose("tid %d: count %lld\n",
(int) rseq_gettid(), i);
#endif #endif
} }
printf_verbose("tid %d: number of rseq abort: %d, signals delivered: %u\n", printf_verbose("tid %d: number of rseq abort: %d, signals delivered: %u\n",
(int) gettid(), nr_abort, signals_delivered); (int) rseq_gettid(), nr_abort, signals_delivered);
if (!opt_disable_rseq && thread_data->reg && if (!opt_disable_rseq && thread_data->reg &&
rseq_unregister_current_thread()) rseq_unregister_current_thread())
abort(); abort();
...@@ -454,11 +455,12 @@ void *test_percpu_inc_thread(void *arg) ...@@ -454,11 +455,12 @@ void *test_percpu_inc_thread(void *arg)
} while (rseq_unlikely(ret)); } while (rseq_unlikely(ret));
#ifndef BENCHMARK #ifndef BENCHMARK
if (i != 0 && !(i % (reps / 10))) if (i != 0 && !(i % (reps / 10)))
printf_verbose("tid %d: count %lld\n", (int) gettid(), i); printf_verbose("tid %d: count %lld\n",
(int) rseq_gettid(), i);
#endif #endif
} }
printf_verbose("tid %d: number of rseq abort: %d, signals delivered: %u\n", printf_verbose("tid %d: number of rseq abort: %d, signals delivered: %u\n",
(int) gettid(), nr_abort, signals_delivered); (int) rseq_gettid(), nr_abort, signals_delivered);
if (!opt_disable_rseq && thread_data->reg && if (!opt_disable_rseq && thread_data->reg &&
rseq_unregister_current_thread()) rseq_unregister_current_thread())
abort(); abort();
...@@ -605,7 +607,7 @@ void *test_percpu_list_thread(void *arg) ...@@ -605,7 +607,7 @@ void *test_percpu_list_thread(void *arg)
} }
printf_verbose("tid %d: number of rseq abort: %d, signals delivered: %u\n", printf_verbose("tid %d: number of rseq abort: %d, signals delivered: %u\n",
(int) gettid(), nr_abort, signals_delivered); (int) rseq_gettid(), nr_abort, signals_delivered);
if (!opt_disable_rseq && rseq_unregister_current_thread()) if (!opt_disable_rseq && rseq_unregister_current_thread())
abort(); abort();
...@@ -796,7 +798,7 @@ void *test_percpu_buffer_thread(void *arg) ...@@ -796,7 +798,7 @@ void *test_percpu_buffer_thread(void *arg)
} }
printf_verbose("tid %d: number of rseq abort: %d, signals delivered: %u\n", printf_verbose("tid %d: number of rseq abort: %d, signals delivered: %u\n",
(int) gettid(), nr_abort, signals_delivered); (int) rseq_gettid(), nr_abort, signals_delivered);
if (!opt_disable_rseq && rseq_unregister_current_thread()) if (!opt_disable_rseq && rseq_unregister_current_thread())
abort(); abort();
...@@ -1011,7 +1013,7 @@ void *test_percpu_memcpy_buffer_thread(void *arg) ...@@ -1011,7 +1013,7 @@ void *test_percpu_memcpy_buffer_thread(void *arg)
} }
printf_verbose("tid %d: number of rseq abort: %d, signals delivered: %u\n", printf_verbose("tid %d: number of rseq abort: %d, signals delivered: %u\n",
(int) gettid(), nr_abort, signals_delivered); (int) rseq_gettid(), nr_abort, signals_delivered);
if (!opt_disable_rseq && rseq_unregister_current_thread()) if (!opt_disable_rseq && rseq_unregister_current_thread())
abort(); abort();
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册