diff options
Diffstat (limited to 'net/socket.c')
-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 6d4716559047..f3cfd48191af 100644 --- a/net/socket.c +++ b/net/socket.c @@ -96,6 +96,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, |