summaryrefslogtreecommitdiffstats
path: root/chrome/renderer/renderer_main.cc
diff options
context:
space:
mode:
authordeanm@chromium.org <deanm@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2009-06-15 09:59:38 +0000
committerdeanm@chromium.org <deanm@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2009-06-15 09:59:38 +0000
commit0ff37cd8a0365e08c649ef6a9e0591ccedac540f (patch)
treef7983082b8081b66e57c3761f8f97421a42c9df6 /chrome/renderer/renderer_main.cc
parent69b43fe355fcbd401fe02d6e9c3028516d192b9c (diff)
downloadchromium_src-0ff37cd8a0365e08c649ef6a9e0591ccedac540f.zip
chromium_src-0ff37cd8a0365e08c649ef6a9e0591ccedac540f.tar.gz
chromium_src-0ff37cd8a0365e08c649ef6a9e0591ccedac540f.tar.bz2
Set process name on Linux
This uses PR_SET_NAME to set the process name. It was useful in looking at memory numbers with the zygote patches. PR_SET_NAME is only avalaible in kernels >= 2.6.9 according to the man page: > PR_SET_NAME (since Linux 2.6.9) > Set the process name for the calling process, using the value in > the location pointed to by (char *) arg2. The name can be up to > 16 bytes long, and should be null terminated if it contains > fewer bytes. shenki@moya ~/src/chromium/src :process-name $ ps --forest PID TTY TIME CMD 5581 pts/2 00:00:00 bash 9559 pts/2 00:00:02 \_ Chromium_Browse 9573 pts/2 00:00:00 | \_ Chromium_Render 9581 pts/2 00:00:02 | \_ Chromium_Render 9584 pts/2 00:00:00 | \_ Chromium_Render Patch by Joel Stanley. Review URL: http://codereview.chromium.org/118060 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@18376 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome/renderer/renderer_main.cc')
-rw-r--r--chrome/renderer/renderer_main.cc9
1 files changed, 9 insertions, 0 deletions
diff --git a/chrome/renderer/renderer_main.cc b/chrome/renderer/renderer_main.cc
index fc4d291..7c40767 100644
--- a/chrome/renderer/renderer_main.cc
+++ b/chrome/renderer/renderer_main.cc
@@ -25,6 +25,10 @@
#include "grit/chromium_strings.h"
#include "grit/generated_resources.h"
+#if defined(OS_LINUX)
+#include <sys/prctl.h>
+#endif
+
// This function provides some ways to test crash and assertion handling
// behavior of the renderer.
static void HandleRendererErrorTestParameters(const CommandLine& command_line) {
@@ -79,6 +83,11 @@ int RendererMain(const MainFunctionParams& parameters) {
MessageLoopForIO main_message_loop;
std::wstring app_name = chrome::kBrowserAppName;
PlatformThread::SetName(WideToASCII(app_name + L"_RendererMain").c_str());
+#if defined(OS_LINUX)
+ // Set the process name so it is easier to distinguish this process from
+ // others. The process name will be trimmed to 15 characters.
+ prctl(PR_SET_NAME, WideToASCII(app_name + L"_Renderer").c_str(), 0, 0, 0);
+#endif
// Initialize the SystemMonitor
base::SystemMonitor::Start();