Track maximum size of message queues, presented in /proc/self/limits.

Signed-off-by: Topi Miettinen <[email protected]>
---
 ipc/mqueue.c | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/ipc/mqueue.c b/ipc/mqueue.c
index ade739f..edccf55 100644
--- a/ipc/mqueue.c
+++ b/ipc/mqueue.c
@@ -287,6 +287,8 @@ static struct inode *mqueue_get_inode(struct super_block 
*sb,
 
                /* all is ok */
                info->user = get_uid(u);
+               /* XXX resource limits apply per task, not per user */
+               bump_rlimit(RLIMIT_MSGQUEUE, u->mq_bytes);
        } else if (S_ISDIR(mode)) {
                inc_nlink(inode);
                /* Some things misbehave if size == 0 on a directory */
-- 
2.8.1

Reply via email to