diff options
author | Mike Chan <mike@android.com> | 2009-01-07 11:40:42 -0800 |
---|---|---|
committer | Arve Hjønnevåg <arve@android.com> | 2013-07-01 13:40:20 -0700 |
commit | 5a5f2f9219cf1df0cbd14542c5c709e34653d7f9 (patch) | |
tree | 7929a24dd4a8a7168b714dd72b4d44e6c37dffb4 /net | |
parent | 0602c1f91f4366b0572f221d01ca6e8f6ab32405 (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 | 10 |
1 files changed, 10 insertions, 0 deletions
diff --git a/net/ipv4/tcp.c b/net/ipv4/tcp.c index 0ce860b93c1..880d2a644ca 100644 --- a/net/ipv4/tcp.c +++ b/net/ipv4/tcp.c @@ -268,6 +268,7 @@ #include <linux/crypto.h> #include <linux/time.h> #include <linux/slab.h> +#include <linux/uid_stat.h> #include <net/icmp.h> #include <net/inet_common.h> @@ -1221,6 +1222,9 @@ out: if (copied) tcp_push(sk, flags, mss_now, tp->nonagle); release_sock(sk); + + if (copied + copied_syn) + uid_stat_tcp_snd(current_uid(), copied + copied_syn); return copied + copied_syn; do_fault: @@ -1525,6 +1529,7 @@ int tcp_read_sock(struct sock *sk, read_descriptor_t *desc, if (copied > 0) { tcp_recv_skb(sk, seq, &offset); tcp_cleanup_rbuf(sk, copied); + uid_stat_tcp_rcv(current_uid(), copied); } return copied; } @@ -1929,6 +1934,9 @@ skip_copy: tcp_cleanup_rbuf(sk, copied); release_sock(sk); + + if (copied > 0) + uid_stat_tcp_rcv(current_uid(), copied); return copied; out: @@ -1937,6 +1945,8 @@ out: recv_urg: err = tcp_recv_urg(sk, msg, len, flags); + if (err > 0) + uid_stat_tcp_rcv(current_uid(), err); goto out; recv_sndq: |