diff options
author | Mike Chan <mike@android.com> | 2009-01-07 11:40:42 -0800 |
---|---|---|
committer | Arve Hjønnevåg <arve@android.com> | 2010-02-08 15:07:45 -0800 |
commit | ab6c8fc0decb0b39f8cff97d4889fef5c3a50aa7 (patch) | |
tree | c070b19d75b20a51d61043f4f10fb794f822ac43 /net | |
parent | 9e0cd4352c967f2a1d50646d7a0e1caa5591d036 (diff) |
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/socket.c | 18 |
1 files changed, 16 insertions, 2 deletions
diff --git a/net/socket.c b/net/socket.c index 75655365b5fd..ed84099da26d 100644 --- a/net/socket.c +++ b/net/socket.c @@ -97,6 +97,10 @@ #include <net/sock.h> #include <linux/netfilter.h> +#ifdef CONFIG_UID_STAT +#include <linux/uid_stat.h> +#endif + static int sock_no_open(struct inode *irrelevant, struct file *dontcare); static ssize_t sock_aio_read(struct kiocb *iocb, const struct iovec *iov, unsigned long nr_segs, loff_t pos); @@ -570,7 +574,12 @@ static inline int __sock_sendmsg(struct kiocb *iocb, struct socket *sock, if (err) return err; - return sock->ops->sendmsg(iocb, sock, msg, size); + err = sock->ops->sendmsg(iocb, sock, msg, size); +#ifdef CONFIG_UID_STAT + if (err > 0) + update_tcp_snd(current_uid(), err); +#endif + return err; } int sock_sendmsg(struct socket *sock, struct msghdr *msg, size_t size) @@ -684,7 +693,12 @@ static inline int __sock_recvmsg(struct kiocb *iocb, struct socket *sock, if (err) return err; - return sock->ops->recvmsg(iocb, sock, msg, size, flags); + err = sock->ops->recvmsg(iocb, sock, msg, size, flags); +#ifdef CONFIG_UID_STAT + if (err > 0) + update_tcp_rcv(current_uid(), err); +#endif + return err; } int sock_recvmsg(struct socket *sock, struct msghdr *msg, |