This source file includes following definitions.
- GetParentProcessId
- GetProcessExecutablePath
#include "base/process/process_handle.h"
#include "base/file_util.h"
#include "base/process/internal_linux.h"
namespace base {
ProcessId GetParentProcessId(ProcessHandle process) {
ProcessId pid =
internal::ReadProcStatsAndGetFieldAsInt64(process, internal::VM_PPID);
if (pid)
return pid;
return -1;
}
FilePath GetProcessExecutablePath(ProcessHandle process) {
FilePath stat_file = internal::GetProcPidDir(process).Append("exe");
FilePath exe_name;
if (!ReadSymbolicLink(stat_file, &exe_name)) {
return FilePath();
}
return exe_name;
}
}