OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #include "content/common/set_process_title.h" | 5 #include "content/common/set_process_title.h" |
6 | 6 |
7 #include "build/build_config.h" | 7 #include "build/build_config.h" |
8 | 8 |
9 #if defined(OS_POSIX) && !defined(OS_MACOSX) && !defined(OS_SOLARIS) | 9 #if defined(OS_POSIX) && !defined(OS_MACOSX) && !defined(OS_SOLARIS) |
10 #include <limits.h> | 10 #include <limits.h> |
11 #include <stdlib.h> | 11 #include <stdlib.h> |
12 #include <unistd.h> | 12 #include <unistd.h> |
13 | 13 |
14 #include <string> | 14 #include <string> |
15 | 15 |
16 #include "base/command_line.h" | 16 #include "base/command_line.h" |
17 #endif // defined(OS_POSIX) && !defined(OS_MACOSX) && !defined(OS_SOLARIS) | 17 #endif // defined(OS_POSIX) && !defined(OS_MACOSX) && !defined(OS_SOLARIS) |
18 | 18 |
19 #if defined(OS_LINUX) | 19 #if defined(OS_LINUX) |
20 #include <sys/prctl.h> | 20 #include <sys/prctl.h> |
21 | 21 |
22 #include "base/file_path.h" | 22 #include "base/file_path.h" |
23 #include "base/file_util.h" | 23 #include "base/file_util.h" |
24 #include "base/process_util.h" | 24 #include "base/process_util.h" |
25 #include "base/string_util.h" | 25 #include "base/string_util.h" |
26 // Linux/glibc doesn't natively have setproctitle(). | 26 // Linux/glibc doesn't natively have setproctitle(). |
27 #include "content/common/set_process_title_linux.h" | 27 #include "content/common/set_process_title_linux.h" |
28 #endif // defined(OS_LINUX) | 28 #endif // defined(OS_LINUX) |
29 | 29 |
| 30 namespace content { |
| 31 |
30 // TODO(jrg): Find out if setproctitle or equivalent is available on Android. | 32 // TODO(jrg): Find out if setproctitle or equivalent is available on Android. |
31 #if defined(OS_POSIX) && !defined(OS_MACOSX) && !defined(OS_SOLARIS) && \ | 33 #if defined(OS_POSIX) && !defined(OS_MACOSX) && !defined(OS_SOLARIS) && \ |
32 !defined(OS_ANDROID) | 34 !defined(OS_ANDROID) |
33 | 35 |
34 void SetProcessTitleFromCommandLine(const char** main_argv) { | 36 void SetProcessTitleFromCommandLine(const char** main_argv) { |
35 // Build a single string which consists of all the arguments separated | 37 // Build a single string which consists of all the arguments separated |
36 // by spaces. We can't actually keep them separate due to the way the | 38 // by spaces. We can't actually keep them separate due to the way the |
37 // setproctitle() function works. | 39 // setproctitle() function works. |
38 std::string title; | 40 std::string title; |
39 bool have_argv0 = false; | 41 bool have_argv0 = false; |
(...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
77 } | 79 } |
78 | 80 |
79 #else | 81 #else |
80 | 82 |
81 // All other systems (basically Windows & Mac) have no need or way to implement | 83 // All other systems (basically Windows & Mac) have no need or way to implement |
82 // this function. | 84 // this function. |
83 void SetProcessTitleFromCommandLine(const char** /* main_argv */) { | 85 void SetProcessTitleFromCommandLine(const char** /* main_argv */) { |
84 } | 86 } |
85 | 87 |
86 #endif | 88 #endif |
| 89 |
| 90 } // namespace content |
OLD | NEW |