Lines Matching refs:pid
39 static bool Exited(pid_t pid) in Exited() argument
42 pid_t waitPid = waitpid(pid, &status, WNOHANG); in Exited()
43 if (waitPid != pid) { in Exited()
48 LOGE("%d died: Process exited with code %d", pid, WEXITSTATUS(status)); in Exited()
50 LOGE("%d died: Process exited due to signal %d", pid, WTERMSIG(status)); in Exited()
52 LOGE("%d died: Process finished for unknown reason", pid); in Exited()
57 bool PidUtils::Quiesce(pid_t pid) in Quiesce() argument
62 if (ptrace(PTRACE_GETSIGINFO, pid, 0, &si) == 0) { in Quiesce()
71 if (ptrace(PTRACE_LISTEN, pid, 0, 0) == -1) { in Quiesce()
78 LOGE("%d: Did not quiesce in 10 seconds", pid); in Quiesce()
82 bool PidUtils::Attach(pid_t pid) in Attach() argument
86 if (ptrace(PTRACE_ATTACH, pid, 0, 0) == 0) { in Attach()
96 if (Quiesce(pid)) { in Attach()
100 if (ptrace(PTRACE_DETACH, pid, 0, 0) == -1) { in Attach()
106 bool PidUtils::Detach(pid_t pid) in Detach() argument
108 if (ptrace(PTRACE_DETACH, pid, 0, 0) == -1) { in Detach()
115 bool PidUtils::WaitForPidState(pid_t pid, const std::function<PidRunEnum()>& stateCheckFunc) in WaitForPidState() argument
120 if (Attach(pid)) { in WaitForPidState()
126 if (!Detach(pid)) { in WaitForPidState()
129 } else if (Exited(pid)) { in WaitForPidState()
135 LOGE("Timed out waiting for pid %d to be ready", pid); in WaitForPidState()
140 bool PidUtils::WaitForPidStateAfterAttach(pid_t pid, const std::function<PidRunEnum()>& stateCheckF… in WaitForPidStateAfterAttach() argument
149 if (!Detach(pid)) { in WaitForPidStateAfterAttach()
153 …(time(nullptr) - startTime < MAX_WAIT_TIME_SECONDS && status == PID_RUN_KEEP_GOING && Attach(pid)); in WaitForPidStateAfterAttach()
155 LOGE("Timed out waiting for pid %d to be ready", pid); in WaitForPidStateAfterAttach()