Skip to content

Commit

Permalink
print pid in ProcessInfo lookup error messages
Browse files Browse the repository at this point in the history
Summary:
It would be helpful to see the pid of the process when we fail to get the process name

Created from CodeHub with https://fburl.com/edit-in-codehub

Reviewed By: kavehahmadi60

Differential Revision: D59873146

fbshipit-source-id: 8d85320688372a5a014e39ecb1aa32ae1b8eac32
  • Loading branch information
genevievehelsel authored and facebook-github-bot committed Jul 18, 2024
1 parent 32b3690 commit e10e99a
Showing 1 changed file with 10 additions and 2 deletions.
12 changes: 10 additions & 2 deletions eden/common/utils/ProcessInfo.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -352,12 +352,20 @@ ProcessSimpleName readProcessSimpleName([[maybe_unused]] pid_t pid) {
auto ret = proc_name(pid, namePtr, len);
if (ret > len) {
// This should never happen.
XLOGF(INFO, "proc_name returned length greater than provided buffer.");
XLOGF(
INFO,
"proc_name for pid {} returned length greater than provided buffer.",
pid);
} else if (ret != 0) {
name.resize(ret);
return ProcessSimpleName(std::string(name.begin(), name.end()));
} else {
XLOGF(DBG2, "proc_name failed: {} ({})", folly::errnoStr(errno), errno);
XLOGF(
DBG2,
"proc_name failed for pid {}: {} ({})",
pid,
folly::errnoStr(errno),
errno);
}
#endif

Expand Down

0 comments on commit e10e99a

Please sign in to comment.