Commit 98ee5dfe authored by Nikita V. Shirokov's avatar Nikita V. Shirokov

fixing bpflist

when you have lots of shortlived progs, there is posibillity of
race condition during proc scanning. you could get pid of this
shortlived prog, but when you will start to read it's fd/ dir
it will fail, as prog would be already terminated
parent f4e1c334
......@@ -72,8 +72,10 @@ def find_bpf_fds(pid):
for pdir in os.listdir('/proc'):
if re.match('\\d+', pdir):
find_bpf_fds(int(pdir))
try:
find_bpf_fds(int(pdir))
except OSError:
continue
print("%-6s %-16s %-8s %s" % ("PID", "COMM", "TYPE", "COUNT"))
for (pid, typ), count in sorted(counts.items(), key=lambda t: t[0][0]):
comm = comm_for_pid(pid)
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment