Lines Matching refs:pid
46 static bool waitpid_with_timeout(pid_t pid, int timeout_ms, int* status) { in waitpid_with_timeout() argument
79 pid_t child_pid = waitpid(pid, status, WNOHANG); in waitpid_with_timeout()
80 if (child_pid != pid) { in waitpid_with_timeout()
82 printf("*** Waiting for pid %d, got pid %d instead\n", pid, child_pid); in waitpid_with_timeout()
288 pid_t pid = fork(); in RunCommandToFd() local
291 if (pid < 0) { in RunCommandToFd()
294 return pid; in RunCommandToFd()
298 if (pid == 0) { in RunCommandToFd()
337 bool ret = waitpid_with_timeout(pid, options.TimeoutInMs(), &status); in RunCommandToFd()
345 static_cast<float>(elapsed) / NANOS_PER_SEC, pid); in RunCommandToFd()
347 static_cast<float>(elapsed) / NANOS_PER_SEC, pid); in RunCommandToFd()
351 static_cast<float>(elapsed) / NANOS_PER_SEC, pid); in RunCommandToFd()
353 static_cast<float>(elapsed) / NANOS_PER_SEC, pid); in RunCommandToFd()
355 kill(pid, SIGTERM); in RunCommandToFd()
356 if (!waitpid_with_timeout(pid, 5000, nullptr)) { in RunCommandToFd()
357 kill(pid, SIGKILL); in RunCommandToFd()
358 if (!waitpid_with_timeout(pid, 5000, nullptr)) { in RunCommandToFd()
361 command, pid); in RunCommandToFd()
362 MYLOGE("could not kill command '%s' (pid %d) even with SIGKILL.\n", command, pid); in RunCommandToFd()