1 // SPDX-License-Identifier: LGPL-2.1 2 #include "trace/beauty/beauty.h" 3 #include "util/machine.h" 4 #include "util/thread.h" 5 6 size_t syscall_arg__scnprintf_pid(char *bf, size_t size, struct syscall_arg *arg) 7 { 8 int pid = arg->val; 9 struct trace *trace = arg->trace; 10 size_t printed = scnprintf(bf, size, "%d", pid); 11 struct thread *thread = machine__findnew_thread(trace__host(trace), pid, pid); 12 13 if (thread != NULL) { 14 if (!thread__comm_set(thread)) 15 thread__set_comm_from_proc(thread); 16 17 if (thread__comm_set(thread)) 18 printed += scnprintf(bf + printed, size - printed, 19 " (%s)", thread__comm_str(thread)); 20 thread__put(thread); 21 } 22 23 return printed; 24 } 25