Lines Matching defs:pid
96 int pid;
101 if (!(pid = atoi(de->d_name))) {
105 sprintf(cmdpath,"/proc/%d/cmdline", pid);
113 helper(pid, cmdline, arg);
119 static void for_each_pid_helper(int pid, const char *cmdline, void *arg) {
121 func(pid, cmdline);
128 static void for_each_tid_helper(int pid, const char *cmdline, void *arg) {
134 sprintf(taskpath, "/proc/%d/task", pid);
141 func(pid, pid, cmdline);
153 if (tid == pid)
170 func(pid, tid, comm);
180 void show_wchan(int pid, int tid, const char *name) {
200 pid == tid ? 0 : 3, "", name);
234 void do_showmap(int pid, const char *name) {
238 sprintf(title, "SHOW MAP %d (%s)", pid, name);
239 sprintf(arg, "%d", pid);
398 bool waitpid_with_timeout(pid_t pid, int timeout_seconds, int* status) {
430 pid_t child_pid = waitpid(pid, status, WNOHANG);
431 if (child_pid != pid) {
433 printf("*** Waiting for pid %d, got pid %d instead\n", pid, child_pid);
446 pid_t pid = fork();
449 if (pid < 0) {
451 return pid;
455 if (pid == 0) {
487 bool ret = waitpid_with_timeout(pid, timeout_seconds, &status);
491 printf("*** %s: Timed out after %.3fs (killing pid %d)\n", command,
492 (float) elapsed / NANOS_PER_SEC, pid);
494 printf("*** %s: Error after %.4fs (killing pid %d)\n", command,
495 (float) elapsed / NANOS_PER_SEC, pid);
497 kill(pid, SIGTERM);
498 if (!waitpid_with_timeout(pid, 5, NULL)) {
499 kill(pid, SIGKILL);
500 if (!waitpid_with_timeout(pid, 5, NULL)) {
501 printf("*** %s: Cannot kill %d even with SIGKILL.\n", command, pid);
684 int pid = atoi(d->d_name);
685 if (pid <= 0) continue;
689 snprintf(path, sizeof(path), "/proc/%d/exe", pid);
698 snprintf(path, sizeof(path), "/proc/%d/cmdline", pid);
712 if (kill(pid, SIGQUIT)) {
713 fprintf(stderr, "kill(%d, SIGQUIT): %s\n", pid, strerror(errno));
723 fprintf(stderr, "warning: timed out dumping pid %d\n", pid);
733 pid, (float)(nanotime() - start) / NANOS_PER_SEC);
746 } else if (dump_backtrace_to_file_timeout(pid, fd, 20) == -1) {
753 pid, (float)(nanotime() - start) / NANOS_PER_SEC);