diff options
author | Mike Chan <mike@android.com> | 2009-01-07 11:40:42 -0800 |
---|---|---|
committer | John Stultz <john.stultz@linaro.org> | 2012-08-10 14:16:07 -0400 |
commit | d020a40812714e544e971e91e5392055a15a4f0d (patch) | |
tree | 69af0714dfb2d45891e25656b045ecf2f97bf5e1 /net | |
parent | a73f1f8534c3b1cf210e8527dbc558e69c962d49 (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 d6a7fcaa5f21..9d95b5ad561c 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> @@ -1253,6 +1254,9 @@ out: if (copied && likely(!tp->repair)) tcp_push(sk, flags, mss_now, tp->nonagle); release_sock(sk); + + if (copied > 0) + uid_stat_tcp_snd(current_uid(), copied); return copied + copied_syn; do_fault: @@ -1545,8 +1549,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); @@ -1944,6 +1951,9 @@ skip_copy: tcp_cleanup_rbuf(sk, copied); release_sock(sk); + + if (copied > 0) + uid_stat_tcp_rcv(current_uid(), copied); return copied; out: @@ -1952,6 +1962,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: |