Index: base/threading/platform_thread_freebsd.cc |
diff --git a/base/threading/platform_thread_linux.cc b/base/threading/platform_thread_freebsd.cc |
similarity index 75% |
copy from base/threading/platform_thread_linux.cc |
copy to base/threading/platform_thread_freebsd.cc |
index 0c0ebcb538d137da970f5fd52cd4fe1fa4167552..4be728203095a88c6456aea132aa269ba48be6bd 100644 |
--- a/base/threading/platform_thread_linux.cc |
+++ b/base/threading/platform_thread_freebsd.cc |
@@ -1,4 +1,4 @@ |
-// Copyright (c) 2012 The Chromium Authors. All rights reserved. |
+// Copyright (c) 2014 The Chromium Authors. All rights reserved. |
// Use of this source code is governed by a BSD-style license that can be |
// found in the LICENSE file. |
@@ -16,10 +16,10 @@ |
#include "base/tracked_objects.h" |
#if !defined(OS_NACL) |
-#include <sys/prctl.h> |
#include <sys/resource.h> |
#include <sys/syscall.h> |
#include <sys/time.h> |
+#include <sys/types.h> |
#include <unistd.h> |
#endif |
@@ -49,22 +49,13 @@ void PlatformThread::SetName(const char* name) { |
tracked_objects::ThreadData::InitializeThreadContext(name); |
#if !defined(OS_NACL) |
- // On linux we can get the thread names to show up in the debugger by setting |
- // the process name for the LWP. We don't want to do this for the main |
- // thread because that would rename the process, causing tools like killall |
- // to stop working. |
+ // On FreeBSD we can get the thread names to show up in the debugger by |
+ // setting the process name for the LWP. We don't want to do this for the |
+ // main thread because that would rename the process, causing tools like |
+ // killall to stop working. |
if (PlatformThread::CurrentId() == getpid()) |
return; |
- |
- // http://0pointer.de/blog/projects/name-your-threads.html |
- // Set the name for the LWP (which gets truncated to 15 characters). |
- // Note that glibc also has a 'pthread_setname_np' api, but it may not be |
- // available everywhere and it's only benefit over using prctl directly is |
- // that it can set the name of threads other than the current thread. |
- int err = prctl(PR_SET_NAME, name); |
- // We expect EPERM failures in sandboxed processes, just ignore those. |
- if (err < 0 && errno != EPERM) |
- DPLOG(ERROR) << "prctl(PR_SET_NAME)"; |
+ setproctitle("%s", name); |
#endif // !defined(OS_NACL) |
} |