Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(3403)

Unified Diff: base/threading/platform_thread_freebsd.cc

Issue 185713005: Add support for FreeBSD in base/ , base/process/ , and base/threading so that the bootstrap binary … (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Remove superfluous newline. Created 6 years, 9 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « base/process/process_metrics_freebsd.cc ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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)
}
« no previous file with comments | « base/process/process_metrics_freebsd.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698