^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1) // SPDX-License-Identifier: LGPL-2.1
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 2)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 3) size_t syscall_arg__scnprintf_pid(char *bf, size_t size, struct syscall_arg *arg)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 4) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 5) int pid = arg->val;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 6) struct trace *trace = arg->trace;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 7) size_t printed = scnprintf(bf, size, "%d", pid);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 8) struct thread *thread = machine__findnew_thread(trace->host, pid, pid);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 9)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 10) if (thread != NULL) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 11) if (!thread->comm_set)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 12) thread__set_comm_from_proc(thread);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 13)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 14) if (thread->comm_set)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 15) printed += scnprintf(bf + printed, size - printed,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 16) " (%s)", thread__comm_str(thread));
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 17) thread__put(thread);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 18) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 19)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 20) return printed;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 21) }