Lines Matching refs:pid

30 static bool Exited(pid_t pid) {  in Exited()  argument
32 pid_t wait_pid = waitpid(pid, &status, WNOHANG); in Exited()
33 if (wait_pid != pid) { in Exited()
38 fprintf(stderr, "%d died: Process exited with code %d\n", pid, WEXITSTATUS(status)); in Exited()
40 fprintf(stderr, "%d died: Process exited due to signal %d\n", pid, WTERMSIG(status)); in Exited()
42 fprintf(stderr, "%d died: Process finished for unknown reason\n", pid); in Exited()
47 bool Quiesce(pid_t pid) { in Quiesce() argument
51 if (ptrace(PTRACE_GETSIGINFO, pid, 0, &si) == 0) { in Quiesce()
58 if (ptrace(PTRACE_LISTEN, pid, 0, 0) == -1) { in Quiesce()
70 fprintf(stderr, "%d: Did not quiesce in 10 seconds\n", pid); in Quiesce()
74 bool Attach(pid_t pid) { in Attach() argument
77 if (ptrace(PTRACE_ATTACH, pid, 0, 0) == 0) { in Attach()
87 if (Quiesce(pid)) { in Attach()
91 if (ptrace(PTRACE_DETACH, pid, 0, 0) == -1) { in Attach()
97 bool Detach(pid_t pid) { in Detach() argument
98 if (ptrace(PTRACE_DETACH, pid, 0, 0) == -1) { in Detach()
107 bool WaitForPidState(pid_t pid, const std::function<PidRunEnum()>& state_check_func) { in WaitForPidState() argument
111 if (Attach(pid)) { in WaitForPidState()
117 if (!Detach(pid)) { in WaitForPidState()
120 } else if (Exited(pid)) { in WaitForPidState()
126 fprintf(stderr, "Timed out waiting for pid %d to be ready\n", pid); in WaitForPidState()
131 bool WaitForPidStateAfterAttach(pid_t pid, const std::function<PidRunEnum()>& state_check_func) { in WaitForPidStateAfterAttach() argument
139 if (!Detach(pid)) { in WaitForPidStateAfterAttach()
144 Attach(pid)); in WaitForPidStateAfterAttach()
146 fprintf(stderr, "Timed out waiting for pid %d to be ready\n", pid); in WaitForPidStateAfterAttach()