diff options
author | Kamil Rytarowski <n54@gmx.com> | 2019-12-24 20:33:54 +0100 |
---|---|---|
committer | Kamil Rytarowski <n54@gmx.com> | 2019-12-24 20:33:54 +0100 |
commit | fc356dcc11c10003ff22acff667b0a9f5e6c1e0f (patch) | |
tree | 94bf7ce33b5b35d28f64d21d12cc8f5ef1f8da7e /compiler-rt | |
parent | c06e53119b1f04696fbcf710aaa0818cbfc99600 (diff) | |
download | bcm5719-llvm-fc356dcc11c10003ff22acff667b0a9f5e6c1e0f.tar.gz bcm5719-llvm-fc356dcc11c10003ff22acff667b0a9f5e6c1e0f.zip |
[compiler-rt] Adapt stop-the-world for ptrace changes in NetBSD-9.99.30
Handle PT_LWPNEXT for newer kernels and keep PT_LWPINFO for older ones.
Diffstat (limited to 'compiler-rt')
-rw-r--r-- | compiler-rt/lib/sanitizer_common/sanitizer_stoptheworld_netbsd_libcdep.cpp | 12 |
1 files changed, 10 insertions, 2 deletions
diff --git a/compiler-rt/lib/sanitizer_common/sanitizer_stoptheworld_netbsd_libcdep.cpp b/compiler-rt/lib/sanitizer_common/sanitizer_stoptheworld_netbsd_libcdep.cpp index 5690d75097f..1ed21343254 100644 --- a/compiler-rt/lib/sanitizer_common/sanitizer_stoptheworld_netbsd_libcdep.cpp +++ b/compiler-rt/lib/sanitizer_common/sanitizer_stoptheworld_netbsd_libcdep.cpp @@ -120,10 +120,18 @@ bool ThreadSuspender::SuspendAllThreads() { VReport(2, "Attached to process %d.\n", pid_); +#ifdef PT_LWPNEXT + struct ptrace_lwpstatus pl; + int op = PT_LWPNEXT; +#else struct ptrace_lwpinfo pl; - int val; + int op = PT_LWPINFO; +#endif + pl.pl_lwpid = 0; - while ((val = ptrace(PT_LWPINFO, pid_, (void *)&pl, sizeof(pl))) != -1 && + + int val; + while ((val = ptrace(op, pid_, (void *)&pl, sizeof(pl))) != -1 && pl.pl_lwpid != 0) { suspended_threads_list_.Append(pl.pl_lwpid); VReport(2, "Appended thread %d in process %d.\n", pl.pl_lwpid, pid_); |