I'm interested in per-process network I/O counters, like those in /proc/net/dev
and found what I thought was it under /proc/<pid>
, i.e. /proc/<pid>/net/dev
. But it seems that was too easy because they contain the same counters as the system.
If I diff between system and <pid>
I get the same counters*. So that makes me wonder what is it supposed to represent? Or is it just a way to allow a specific process to read /proc/net/dev
by setting permissions to /proc/net/<pid>/dev
and not globally?
man proc
does not document this and neither does http://man7.org/linux/man-pages/man5/proc.5.html
Distro: CentOS 7.1 w/ kernel 3.10.0-229.el7.x86_64
*diff <(cat /proc/<pid>/net/dev) <(cat /proc/net/dev)
Best Answer
/proc/net/dev
contains statistics about network interfaces, while/proc/<pid>/net/dev
contains statistics about network interfaces from the process' point of view.I suppose that if a process runs on a network namespace (see
man ip-netns
) where it has access only to a limited set of interfaces, only these will show up in/proc/<pid>/net/dev
.