xref: /aosp_15_r20/external/cronet/base/process/set_process_title.h (revision 6777b5387eb2ff775bb5750e3f5d96f37fb7352b)
1*6777b538SAndroid Build Coastguard Worker // Copyright 2010 The Chromium Authors
2*6777b538SAndroid Build Coastguard Worker // Use of this source code is governed by a BSD-style license that can be
3*6777b538SAndroid Build Coastguard Worker // found in the LICENSE file.
4*6777b538SAndroid Build Coastguard Worker 
5*6777b538SAndroid Build Coastguard Worker #ifndef BASE_PROCESS_SET_PROCESS_TITLE_H_
6*6777b538SAndroid Build Coastguard Worker #define BASE_PROCESS_SET_PROCESS_TITLE_H_
7*6777b538SAndroid Build Coastguard Worker 
8*6777b538SAndroid Build Coastguard Worker #include "base/base_export.h"
9*6777b538SAndroid Build Coastguard Worker 
10*6777b538SAndroid Build Coastguard Worker namespace base {
11*6777b538SAndroid Build Coastguard Worker 
12*6777b538SAndroid Build Coastguard Worker // Sets OS-specific process title information based on the command line. This
13*6777b538SAndroid Build Coastguard Worker // does nothing if the OS doesn't support or need this capability.
14*6777b538SAndroid Build Coastguard Worker //
15*6777b538SAndroid Build Coastguard Worker // Pass in the argv from main(). On Windows, where there is no argv, you can
16*6777b538SAndroid Build Coastguard Worker // pass null or just don't call this function, since it does nothing. This
17*6777b538SAndroid Build Coastguard Worker // argv pointer will be cached so if you call this function again, you can pass
18*6777b538SAndroid Build Coastguard Worker // null in the second call. This is to support the case where it's called once
19*6777b538SAndroid Build Coastguard Worker // at startup, and later when a zygote is fork()ed. The later call doesn't have
20*6777b538SAndroid Build Coastguard Worker // easy access to main's argv.
21*6777b538SAndroid Build Coastguard Worker //
22*6777b538SAndroid Build Coastguard Worker // On non-Mac Unix platforms, we exec ourselves from /proc/self/exe, but that
23*6777b538SAndroid Build Coastguard Worker // makes the process name that shows up in "ps" etc. for the child processes
24*6777b538SAndroid Build Coastguard Worker // show as "exe" instead of "chrome" or something reasonable. This function
25*6777b538SAndroid Build Coastguard Worker // will try to fix it so the "effective" command line shows up instead.
26*6777b538SAndroid Build Coastguard Worker BASE_EXPORT void SetProcessTitleFromCommandLine(const char** main_argv);
27*6777b538SAndroid Build Coastguard Worker 
28*6777b538SAndroid Build Coastguard Worker }  // namespace base
29*6777b538SAndroid Build Coastguard Worker 
30*6777b538SAndroid Build Coastguard Worker #endif  // BASE_PROCESS_SET_PROCESS_TITLE_H_
31