Avi Drissman | 4e1b7bc3 | 2022-09-15 14:03:50 | [diff] [blame] | 1 | // Copyright 2010 The Chromium Authors |
[email protected] | 74e9fa2 | 2010-12-29 21:06:43 | [diff] [blame] | 2 | // Use of this source code is governed by a BSD-style license that can be |
| 3 | // found in the LICENSE file. |
| 4 | |
Shintaro Kawamura | 20d4a7d | 2024-03-08 05:16:24 | [diff] [blame] | 5 | #ifndef BASE_PROCESS_SET_PROCESS_TITLE_H_ |
| 6 | #define BASE_PROCESS_SET_PROCESS_TITLE_H_ |
[email protected] | 74e9fa2 | 2010-12-29 21:06:43 | [diff] [blame] | 7 | |
Shintaro Kawamura | 20d4a7d | 2024-03-08 05:16:24 | [diff] [blame] | 8 | #include "base/base_export.h" |
| 9 | |
| 10 | namespace base { |
rockot | 60d92c2 | 2017-03-21 06:35:23 | [diff] [blame] | 11 | |
[email protected] | 74e9fa2 | 2010-12-29 21:06:43 | [diff] [blame] | 12 | // Sets OS-specific process title information based on the command line. This |
| 13 | // does nothing if the OS doesn't support or need this capability. |
| 14 | // |
| 15 | // Pass in the argv from main(). On Windows, where there is no argv, you can |
Ken Rockot | 30f6a4a | 2020-09-17 08:34:01 | [diff] [blame] | 16 | // pass null or just don't call this function, since it does nothing. This |
[email protected] | 74e9fa2 | 2010-12-29 21:06:43 | [diff] [blame] | 17 | // argv pointer will be cached so if you call this function again, you can pass |
Ken Rockot | 30f6a4a | 2020-09-17 08:34:01 | [diff] [blame] | 18 | // null in the second call. This is to support the case where it's called once |
[email protected] | 74e9fa2 | 2010-12-29 21:06:43 | [diff] [blame] | 19 | // at startup, and later when a zygote is fork()ed. The later call doesn't have |
| 20 | // easy access to main's argv. |
| 21 | // |
| 22 | // On non-Mac Unix platforms, we exec ourselves from /proc/self/exe, but that |
| 23 | // makes the process name that shows up in "ps" etc. for the child processes |
| 24 | // show as "exe" instead of "chrome" or something reasonable. This function |
| 25 | // will try to fix it so the "effective" command line shows up instead. |
Shintaro Kawamura | 20d4a7d | 2024-03-08 05:16:24 | [diff] [blame] | 26 | BASE_EXPORT void SetProcessTitleFromCommandLine(const char** main_argv); |
[email protected] | 74e9fa2 | 2010-12-29 21:06:43 | [diff] [blame] | 27 | |
Shintaro Kawamura | 20d4a7d | 2024-03-08 05:16:24 | [diff] [blame] | 28 | } // namespace base |
[email protected] | 3827e970 | 2012-10-23 06:19:28 | [diff] [blame] | 29 | |
Shintaro Kawamura | 20d4a7d | 2024-03-08 05:16:24 | [diff] [blame] | 30 | #endif // BASE_PROCESS_SET_PROCESS_TITLE_H_ |