summaryrefslogtreecommitdiff
path: root/net
diff options
context:
space:
mode:
authorMike Chan <mike@android.com>2010-11-01 14:55:54 +0800
committerXinyu Chen <xinyu.chen@freescale.com>2011-02-12 15:47:08 +0800
commit926b384685e4845bd7fada13a7cacd162d77e656 (patch)
tree54fe1591662655071af120bb4e6098872ecca0b3 /net
parente8f5022c35a4dd14895ffdd5091c54054348fe81 (diff)
ipv4: using uid stat driver for android to collect network statistics.
Signed-off-by: Mike Chan <mike@android.com>
Diffstat (limited to 'net')
-rw-r--r--net/ipv4/tcp.c13
1 files changed, 12 insertions, 1 deletions
diff --git a/net/ipv4/tcp.c b/net/ipv4/tcp.c
index 65afeaec15b7..61dccaf37f1c 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>
@@ -1101,6 +1102,9 @@ out:
tcp_push(sk, flags, mss_now, tp->nonagle);
TCP_CHECK_TIMER(sk);
release_sock(sk);
+
+ if (copied > 0)
+ uid_stat_tcp_snd(current_uid(), copied);
return copied;
do_fault:
@@ -1377,8 +1381,10 @@ 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;
}
@@ -1764,6 +1770,9 @@ skip_copy:
TCP_CHECK_TIMER(sk);
release_sock(sk);
+
+ if (copied > 0)
+ uid_stat_tcp_rcv(current_uid(), copied);
return copied;
out:
@@ -1773,6 +1782,8 @@ out:
recv_urg:
err = tcp_recv_urg(sk, msg, len, flags);
+ if (err > 0)
+ uid_stat_tcp_rcv(current_uid(), err);
goto out;
}