]>
Commit | Line | Data |
---|---|---|
b2441318 | 1 | // SPDX-License-Identifier: GPL-2.0 |
ff2f1b2d | 2 | size_t syscall_arg__scnprintf_pid(char *bf, size_t size, struct syscall_arg *arg) |
d1d438a3 ACM |
3 | { |
4 | int pid = arg->val; | |
5 | struct trace *trace = arg->trace; | |
6 | size_t printed = scnprintf(bf, size, "%d", pid); | |
073e5fca | 7 | struct thread *thread = machine__findnew_thread(trace->host, pid, pid); |
d1d438a3 ACM |
8 | |
9 | if (thread != NULL) { | |
073e5fca ACM |
10 | if (!thread->comm_set) |
11 | thread__set_comm_from_proc(thread); | |
12 | ||
d1d438a3 ACM |
13 | if (thread->comm_set) |
14 | printed += scnprintf(bf + printed, size - printed, | |
15 | " (%s)", thread__comm_str(thread)); | |
16 | thread__put(thread); | |
17 | } | |
18 | ||
19 | return printed; | |
20 | } |