Back to home page

OSCL-LXR

 
 

    


0001 // SPDX-License-Identifier: LGPL-2.1
0002 
0003 size_t syscall_arg__scnprintf_pid(char *bf, size_t size, struct syscall_arg *arg)
0004 {
0005     int pid = arg->val;
0006     struct trace *trace = arg->trace;
0007     size_t printed = scnprintf(bf, size, "%d", pid);
0008     struct thread *thread = machine__findnew_thread(trace->host, pid, pid);
0009 
0010     if (thread != NULL) {
0011         if (!thread->comm_set)
0012             thread__set_comm_from_proc(thread);
0013 
0014         if (thread->comm_set)
0015             printed += scnprintf(bf + printed, size - printed,
0016                          " (%s)", thread__comm_str(thread));
0017         thread__put(thread);
0018     }
0019 
0020     return printed;
0021 }