diff options
author | Mike Chan <mike@android.com> | 2009-01-07 11:40:42 -0800 |
---|---|---|
committer | Dan Willemsen <dwillemsen@nvidia.com> | 2011-11-30 21:37:55 -0800 |
commit | 78a2dce1100b2520ac881f5e7a0f9dad9d250b2c (patch) | |
tree | 5b4c88b6c990ead64f3ac6b1dc4434de570c86c0 /net | |
parent | ab730dbeb580da1799d3441651accd78797b86e6 (diff) |
misc: uidstat: Adding uid stat driver to collect network statistics.
Signed-off-by: Mike Chan <mike@android.com>
Diffstat (limited to 'net')
-rw-r--r-- | net/ipv4/tcp.c | 14 |
1 files changed, 13 insertions, 1 deletions
diff --git a/net/ipv4/tcp.c b/net/ipv4/tcp.c index 46febcacb729..87ee0ad29a51 100644 --- a/net/ipv4/tcp.c +++ b/net/ipv4/tcp.c @@ -266,6 +266,7 @@ #include <linux/crypto.h> #include <linux/time.h> #include <linux/slab.h> +#include <linux/uid_stat.h> #include <net/icmp.h> #include <net/tcp.h> @@ -1112,6 +1113,9 @@ out: if (copied) tcp_push(sk, flags, mss_now, tp->nonagle); release_sock(sk); + + if (copied > 0) + uid_stat_tcp_snd(current_uid(), copied); return copied; do_fault: @@ -1388,8 +1392,11 @@ int tcp_read_sock(struct sock *sk, read_descriptor_t *desc, tcp_rcv_space_adjust(sk); /* Clean up data we have read: This will do ACK frames. */ - if (copied > 0) + if (copied > 0) { tcp_cleanup_rbuf(sk, copied); + uid_stat_tcp_rcv(current_uid(), copied); + } + return copied; } EXPORT_SYMBOL(tcp_read_sock); @@ -1771,6 +1778,9 @@ skip_copy: tcp_cleanup_rbuf(sk, copied); release_sock(sk); + + if (copied > 0) + uid_stat_tcp_rcv(current_uid(), copied); return copied; out: @@ -1779,6 +1789,8 @@ out: recv_urg: err = tcp_recv_urg(sk, msg, len, flags); + if (err > 0) + uid_stat_tcp_rcv(current_uid(), err); goto out; } EXPORT_SYMBOL(tcp_recvmsg); |