MCPcopy Create free account
hub / github.com/F-Stack/f-stack / bpf_pidname

Function bpf_pidname

tools/netstat/bpf.c:59–77  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

57/* print bpf stats */
58
59static char *
60bpf_pidname(pid_t pid)
61{
62 struct kinfo_proc newkp;
63 int error, mib[4];
64 size_t size;
65
66 mib[0] = CTL_KERN;
67 mib[1] = KERN_PROC;
68 mib[2] = KERN_PROC_PID;
69 mib[3] = pid;
70 size = sizeof(newkp);
71 error = sysctl(mib, 4, &newkp, &size, NULL, 0);
72 if (error < 0) {
73 xo_warn("kern.proc.pid failed");
74 return (strdup("??????"));
75 }
76 return (strdup(newkp.ki_comm));
77}
78
79static void
80bpf_flags(struct xbpf_d *bd, char *flagbuf)

Callers 1

bpf_statsFunction · 0.85

Calls 3

sysctlFunction · 0.85
xo_warnFunction · 0.85
strdupFunction · 0.85

Tested by

no test coverage detected