Source-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[src/trunk]: src/tests/lib/libc/sys Read TLS base pointer with _lwp_getprivate()



details:   https://anonhg.NetBSD.org/src/rev/45cfca32ca04
branches:  trunk
changeset: 967871:45cfca32ca04
user:      kamil <kamil%NetBSD.org@localhost>
date:      Wed Dec 25 02:23:37 2019 +0000

description:
Read TLS base pointer with _lwp_getprivate()

This avoid usage of fast versions that are mostly internal to RTLD.

diffstat:

 tests/lib/libc/sys/t_ptrace_wait.c |  22 ++++------------------
 1 files changed, 4 insertions(+), 18 deletions(-)

diffs (59 lines):

diff -r a7ae8e1c0896 -r 45cfca32ca04 tests/lib/libc/sys/t_ptrace_wait.c
--- a/tests/lib/libc/sys/t_ptrace_wait.c        Wed Dec 25 01:19:56 2019 +0000
+++ b/tests/lib/libc/sys/t_ptrace_wait.c        Wed Dec 25 02:23:37 2019 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: t_ptrace_wait.c,v 1.144 2019/12/24 21:09:38 kamil Exp $        */
+/*     $NetBSD: t_ptrace_wait.c,v 1.145 2019/12/25 02:23:37 kamil Exp $        */
 
 /*-
  * Copyright (c) 2016, 2017, 2018, 2019 The NetBSD Foundation, Inc.
@@ -27,10 +27,9 @@
  */
 
 #include <sys/cdefs.h>
-__RCSID("$NetBSD: t_ptrace_wait.c,v 1.144 2019/12/24 21:09:38 kamil Exp $");
+__RCSID("$NetBSD: t_ptrace_wait.c,v 1.145 2019/12/25 02:23:37 kamil Exp $");
 
 #define __LEGACY_PT_LWPINFO
-#define _RTLD_SOURCE
 
 #include <sys/param.h>
 #include <sys/types.h>
@@ -4804,19 +4803,6 @@
 
 /// ----------------------------------------------------------------------------
 
-static void *
-get_private(void)
-{
-
-#ifdef __HAVE___LWP_GETTCB_FAST
-       return __lwp_gettcb_fast();
-#elif defined(__HAVE___LWP_GETPRIVATE_FAST)
-       return __lwp_getprivate_fast();
-#else
-#error Unknown code path!
-#endif
-}
-
 static int lwpinfo_thread_sigmask[] = {SIGXCPU, SIGPIPE, SIGALRM, SIGURG};
 
 static pthread_mutex_t lwpinfo_thread_mtx = PTHREAD_MUTEX_INITIALIZER;
@@ -4831,7 +4817,7 @@
 
        tcb = (volatile void **)arg;
 
-       *tcb = get_private();
+       *tcb = _lwp_getprivate();
        DPRINTF("Storing tcb[] = %p from thread %d\n", *tcb, _lwp_self());
 
        pthread_setname_np(pthread_self(), "thread %d",
@@ -4885,7 +4871,7 @@
                DPRINTF("Before calling PT_TRACE_ME from child %d\n", getpid());
                FORKEE_ASSERT(ptrace(PT_TRACE_ME, 0, NULL, 0) != -1);
 
-               tcb[0] = get_private();
+               tcb[0] = _lwp_getprivate();
                DPRINTF("Storing tcb[0] = %p\n", tcb[0]);
 
                pthread_setname_np(pthread_self(), "thread %d",



Home | Main Index | Thread Index | Old Index