pid.c 573 B

12345678910111213141516171819202122
  1. static size_t syscall_arg__scnprintf_pid(char *bf, size_t size, struct syscall_arg *arg)
  2. {
  3. int pid = arg->val;
  4. struct trace *trace = arg->trace;
  5. size_t printed = scnprintf(bf, size, "%d", pid);
  6. struct thread *thread = machine__findnew_thread(trace->host, pid, pid);
  7. if (thread != NULL) {
  8. if (!thread->comm_set)
  9. thread__set_comm_from_proc(thread);
  10. if (thread->comm_set)
  11. printed += scnprintf(bf + printed, size - printed,
  12. " (%s)", thread__comm_str(thread));
  13. thread__put(thread);
  14. }
  15. return printed;
  16. }
  17. #define SCA_PID syscall_arg__scnprintf_pid