From b0d208a0abdfedf12dd981453620a7a01d3e076f Mon Sep 17 00:00:00 2001 From: Kuba Mracek Date: Mon, 7 Aug 2017 18:07:20 +0000 Subject: [PATCH] [sanitizer] Remove use of task_for_pid from sanitizer_stoptheworld_mac.cc Using task_for_pid to get the "self" task is not necessary, and it can fail (e.g. for sandboxed processes). Let's just use mach_task_self(). Differential Revision: https://reviews.llvm.org/D36284 llvm-svn: 310271 --- compiler-rt/lib/sanitizer_common/sanitizer_stoptheworld_mac.cc | 10 +--------- 1 file changed, 1 insertion(+), 9 deletions(-) diff --git a/compiler-rt/lib/sanitizer_common/sanitizer_stoptheworld_mac.cc b/compiler-rt/lib/sanitizer_common/sanitizer_stoptheworld_mac.cc index 0c27c47..d84ebef 100644 --- a/compiler-rt/lib/sanitizer_common/sanitizer_stoptheworld_mac.cc +++ b/compiler-rt/lib/sanitizer_common/sanitizer_stoptheworld_mac.cc @@ -55,17 +55,9 @@ void RunThread(void *arg) { struct RunThreadArgs *run_args = (struct RunThreadArgs *)arg; SuspendedThreadsListMac suspended_threads_list; - mach_port_t task; - kern_return_t err = task_for_pid(mach_task_self(), internal_getpid(), &task); - if (err != KERN_SUCCESS) { - VReport(1, "Getting task from pid failed (errno %d).\n", err); - return; - } - thread_array_t threads; mach_msg_type_number_t num_threads; - - err = task_threads(task, &threads, &num_threads); + kern_return_t err = task_threads(mach_task_self(), &threads, &num_threads); if (err != KERN_SUCCESS) { VReport(1, "Failed to get threads for task (errno %d).\n", err); return; -- 2.7.4