getpid() (such as used in base/logging.cc) is meaningless on Fuchsia |
|
Issue descriptionYou reminded me about HANDLE_EINTR/IGNORE_EINTR in mini_chromium, but here’s the other thing that occurred to me. https://fuchsia.googlesource.com/zircon/+/f3e2126c8a8b2ff64ca6cb7818f0606ceb5f889a/third_party/ulib/musl/stubs/idstubs.c: 8 #define ZX_PID ((pid_t)3) […] 57 static pid_t stub_getpid(void) { 58 return ZX_PID; 59 } 60 weak_alias(stub_getpid, getpid); 3: that’s not very useful. getpid() is used to obtain the process ID for logging purposes (https://chromium.googlesource.com/chromium/src/+/4c6f8e1d631dd75d5444b284b84c8fc4b577856d/base/logging.cc#161, https://chromium.googlesource.com/chromium/src/+/4c6f8e1d631dd75d5444b284b84c8fc4b577856d/base/logging.cc#849). At least in mini_chromium’s version, the Fuchsia thread ID comes from the thread’s koid. https://chromium.googlesource.com/chromium/mini_chromium/+/7de4d23ce54fbe4469704075f3857ea31ce576f5/base/logging.cc#322. (It appears that non-mini Chromium’s logging doesn’t do this, and uses zx_thread_self() instead. Is that less system-unique than the koid?) Would the koid be a better process identifier too to use for mini_chromium logging, Chromium logging, or both? My main use for a unique process identifier (that is, not “3”) is to make clear that different messages are produced by different processes in a multi-process scenario. |
|
►
Sign in to add a comment |
|
Comment 1 by bugdroid1@chromium.org
, Dec 5 2017