
From: Chris Wright <chrisw@osdl.org>

Add an rlimit entry to control the maximum number of bytes a user can allocate
to a POSIX mqueue.


---

 25-akpm/arch/alpha/kernel/init_task.c     |    1 +
 25-akpm/arch/arm/kernel/init_task.c       |    1 +
 25-akpm/arch/arm26/kernel/init_task.c     |    1 +
 25-akpm/arch/cris/kernel/process.c        |    1 +
 25-akpm/arch/h8300/kernel/init_task.c     |    1 +
 25-akpm/arch/i386/kernel/init_task.c      |    1 +
 25-akpm/arch/ia64/kernel/init_task.c      |    1 +
 25-akpm/arch/m68k/kernel/process.c        |    1 +
 25-akpm/arch/m68knommu/kernel/init_task.c |    1 +
 25-akpm/arch/mips/kernel/init_task.c      |    1 +
 25-akpm/arch/parisc/kernel/init_task.c    |    1 +
 25-akpm/arch/ppc/kernel/process.c         |    1 +
 25-akpm/arch/ppc64/kernel/init_task.c     |    1 +
 25-akpm/arch/s390/kernel/init_task.c      |    1 +
 25-akpm/arch/sh/kernel/init_task.c        |    1 +
 25-akpm/arch/sparc/kernel/init_task.c     |    1 +
 25-akpm/arch/sparc64/kernel/init_task.c   |    1 +
 25-akpm/arch/um/kernel/init_task.c        |    1 +
 25-akpm/arch/v850/kernel/init_task.c      |    1 +
 25-akpm/arch/x86_64/kernel/init_task.c    |    1 +
 25-akpm/include/asm-alpha/resource.h      |    4 +++-
 25-akpm/include/asm-arm/resource.h        |    4 +++-
 25-akpm/include/asm-arm26/resource.h      |    4 +++-
 25-akpm/include/asm-cris/resource.h       |    4 +++-
 25-akpm/include/asm-h8300/resource.h      |    4 +++-
 25-akpm/include/asm-i386/resource.h       |    4 +++-
 25-akpm/include/asm-ia64/resource.h       |    4 +++-
 25-akpm/include/asm-m68k/resource.h       |    4 +++-
 25-akpm/include/asm-mips/resource.h       |    4 +++-
 25-akpm/include/asm-parisc/resource.h     |    4 +++-
 25-akpm/include/asm-ppc/resource.h        |    4 +++-
 25-akpm/include/asm-ppc64/resource.h      |    4 +++-
 25-akpm/include/asm-s390/resource.h       |    4 +++-
 25-akpm/include/asm-sh/resource.h         |    4 +++-
 25-akpm/include/asm-sparc/resource.h      |    4 +++-
 25-akpm/include/asm-sparc64/resource.h    |    4 +++-
 25-akpm/include/asm-v850/resource.h       |    4 +++-
 25-akpm/include/asm-x86_64/resource.h     |    4 +++-
 25-akpm/include/linux/mqueue.h            |    2 ++
 39 files changed, 76 insertions(+), 18 deletions(-)

diff -puN arch/alpha/kernel/init_task.c~rlim-add-rlimit-entry-for-posix-mqueue-allocation arch/alpha/kernel/init_task.c
--- 25/arch/alpha/kernel/init_task.c~rlim-add-rlimit-entry-for-posix-mqueue-allocation	Wed May 19 15:16:00 2004
+++ 25-akpm/arch/alpha/kernel/init_task.c	Wed May 19 15:16:00 2004
@@ -4,6 +4,7 @@
 #include <linux/init.h>
 #include <linux/init_task.h>
 #include <linux/fs.h>
+#include <linux/mqueue.h>
 #include <asm/uaccess.h>
 
 
diff -puN arch/arm26/kernel/init_task.c~rlim-add-rlimit-entry-for-posix-mqueue-allocation arch/arm26/kernel/init_task.c
--- 25/arch/arm26/kernel/init_task.c~rlim-add-rlimit-entry-for-posix-mqueue-allocation	Wed May 19 15:16:00 2004
+++ 25-akpm/arch/arm26/kernel/init_task.c	Wed May 19 15:16:00 2004
@@ -10,6 +10,7 @@
 #include <linux/sched.h>
 #include <linux/init.h>
 #include <linux/init_task.h>
+#include <linux/mqueue.h>
 
 #include <asm/uaccess.h>
 #include <asm/pgtable.h>
diff -puN arch/arm/kernel/init_task.c~rlim-add-rlimit-entry-for-posix-mqueue-allocation arch/arm/kernel/init_task.c
--- 25/arch/arm/kernel/init_task.c~rlim-add-rlimit-entry-for-posix-mqueue-allocation	Wed May 19 15:16:00 2004
+++ 25-akpm/arch/arm/kernel/init_task.c	Wed May 19 15:16:00 2004
@@ -7,6 +7,7 @@
 #include <linux/sched.h>
 #include <linux/init.h>
 #include <linux/init_task.h>
+#include <linux/mqueue.h>
 
 #include <asm/uaccess.h>
 #include <asm/pgtable.h>
diff -puN arch/h8300/kernel/init_task.c~rlim-add-rlimit-entry-for-posix-mqueue-allocation arch/h8300/kernel/init_task.c
--- 25/arch/h8300/kernel/init_task.c~rlim-add-rlimit-entry-for-posix-mqueue-allocation	Wed May 19 15:16:00 2004
+++ 25-akpm/arch/h8300/kernel/init_task.c	Wed May 19 15:16:00 2004
@@ -7,6 +7,7 @@
 #include <linux/init.h>
 #include <linux/init_task.h>
 #include <linux/fs.h>
+#include <linux/mqueue.h>
 
 #include <asm/uaccess.h>
 #include <asm/pgtable.h>
diff -puN arch/i386/kernel/init_task.c~rlim-add-rlimit-entry-for-posix-mqueue-allocation arch/i386/kernel/init_task.c
--- 25/arch/i386/kernel/init_task.c~rlim-add-rlimit-entry-for-posix-mqueue-allocation	Wed May 19 15:16:00 2004
+++ 25-akpm/arch/i386/kernel/init_task.c	Wed May 19 15:16:00 2004
@@ -4,6 +4,7 @@
 #include <linux/init.h>
 #include <linux/init_task.h>
 #include <linux/fs.h>
+#include <linux/mqueue.h>
 
 #include <asm/uaccess.h>
 #include <asm/pgtable.h>
diff -puN arch/ia64/kernel/init_task.c~rlim-add-rlimit-entry-for-posix-mqueue-allocation arch/ia64/kernel/init_task.c
--- 25/arch/ia64/kernel/init_task.c~rlim-add-rlimit-entry-for-posix-mqueue-allocation	Wed May 19 15:16:00 2004
+++ 25-akpm/arch/ia64/kernel/init_task.c	Wed May 19 15:16:00 2004
@@ -11,6 +11,7 @@
 #include <linux/module.h>
 #include <linux/sched.h>
 #include <linux/init_task.h>
+#include <linux/mqueue.h>
 
 #include <asm/uaccess.h>
 #include <asm/pgtable.h>
diff -puN arch/m68knommu/kernel/init_task.c~rlim-add-rlimit-entry-for-posix-mqueue-allocation arch/m68knommu/kernel/init_task.c
--- 25/arch/m68knommu/kernel/init_task.c~rlim-add-rlimit-entry-for-posix-mqueue-allocation	Wed May 19 15:16:00 2004
+++ 25-akpm/arch/m68knommu/kernel/init_task.c	Wed May 19 15:16:00 2004
@@ -7,6 +7,7 @@
 #include <linux/init.h>
 #include <linux/init_task.h>
 #include <linux/fs.h>
+#include <linux/mqueue.h>
 
 #include <asm/uaccess.h>
 #include <asm/pgtable.h>
diff -puN arch/mips/kernel/init_task.c~rlim-add-rlimit-entry-for-posix-mqueue-allocation arch/mips/kernel/init_task.c
--- 25/arch/mips/kernel/init_task.c~rlim-add-rlimit-entry-for-posix-mqueue-allocation	Wed May 19 15:16:00 2004
+++ 25-akpm/arch/mips/kernel/init_task.c	Wed May 19 15:16:00 2004
@@ -3,6 +3,7 @@
 #include <linux/sched.h>
 #include <linux/init_task.h>
 #include <linux/fs.h>
+#include <linux/mqueue.h>
 
 #include <asm/thread_info.h>
 #include <asm/uaccess.h>
diff -puN arch/parisc/kernel/init_task.c~rlim-add-rlimit-entry-for-posix-mqueue-allocation arch/parisc/kernel/init_task.c
--- 25/arch/parisc/kernel/init_task.c~rlim-add-rlimit-entry-for-posix-mqueue-allocation	Wed May 19 15:16:00 2004
+++ 25-akpm/arch/parisc/kernel/init_task.c	Wed May 19 15:16:00 2004
@@ -27,6 +27,7 @@
 #include <linux/sched.h>
 #include <linux/init.h>
 #include <linux/init_task.h>
+#include <linux/mqueue.h>
 
 #include <asm/uaccess.h>
 #include <asm/pgtable.h>
diff -puN arch/ppc64/kernel/init_task.c~rlim-add-rlimit-entry-for-posix-mqueue-allocation arch/ppc64/kernel/init_task.c
--- 25/arch/ppc64/kernel/init_task.c~rlim-add-rlimit-entry-for-posix-mqueue-allocation	Wed May 19 15:16:00 2004
+++ 25-akpm/arch/ppc64/kernel/init_task.c	Wed May 19 15:16:00 2004
@@ -4,6 +4,7 @@
 #include <linux/init.h>
 #include <linux/init_task.h>
 #include <linux/fs.h>
+#include <linux/mqueue.h>
 #include <asm/uaccess.h>
 
 static struct fs_struct init_fs = INIT_FS;
diff -puN arch/s390/kernel/init_task.c~rlim-add-rlimit-entry-for-posix-mqueue-allocation arch/s390/kernel/init_task.c
--- 25/arch/s390/kernel/init_task.c~rlim-add-rlimit-entry-for-posix-mqueue-allocation	Wed May 19 15:16:00 2004
+++ 25-akpm/arch/s390/kernel/init_task.c	Wed May 19 15:16:00 2004
@@ -10,6 +10,7 @@
 #include <linux/module.h>
 #include <linux/sched.h>
 #include <linux/init_task.h>
+#include <linux/mqueue.h>
 
 #include <asm/uaccess.h>
 #include <asm/pgtable.h>
diff -puN arch/sh/kernel/init_task.c~rlim-add-rlimit-entry-for-posix-mqueue-allocation arch/sh/kernel/init_task.c
--- 25/arch/sh/kernel/init_task.c~rlim-add-rlimit-entry-for-posix-mqueue-allocation	Wed May 19 15:16:00 2004
+++ 25-akpm/arch/sh/kernel/init_task.c	Wed May 19 15:16:00 2004
@@ -2,6 +2,7 @@
 #include <linux/module.h>
 #include <linux/sched.h>
 #include <linux/init_task.h>
+#include <linux/mqueue.h>
 
 #include <asm/uaccess.h>
 #include <asm/pgtable.h>
diff -puN arch/sparc64/kernel/init_task.c~rlim-add-rlimit-entry-for-posix-mqueue-allocation arch/sparc64/kernel/init_task.c
--- 25/arch/sparc64/kernel/init_task.c~rlim-add-rlimit-entry-for-posix-mqueue-allocation	Wed May 19 15:16:00 2004
+++ 25-akpm/arch/sparc64/kernel/init_task.c	Wed May 19 15:16:00 2004
@@ -2,6 +2,7 @@
 #include <linux/module.h>
 #include <linux/sched.h>
 #include <linux/init_task.h>
+#include <linux/mqueue.h>
 
 #include <asm/pgtable.h>
 #include <asm/uaccess.h>
diff -puN arch/sparc/kernel/init_task.c~rlim-add-rlimit-entry-for-posix-mqueue-allocation arch/sparc/kernel/init_task.c
--- 25/arch/sparc/kernel/init_task.c~rlim-add-rlimit-entry-for-posix-mqueue-allocation	Wed May 19 15:16:00 2004
+++ 25-akpm/arch/sparc/kernel/init_task.c	Wed May 19 15:16:00 2004
@@ -2,6 +2,7 @@
 #include <linux/module.h>
 #include <linux/sched.h>
 #include <linux/init_task.h>
+#include <linux/mqueue.h>
 
 #include <asm/pgtable.h>
 #include <asm/uaccess.h>
diff -puN arch/um/kernel/init_task.c~rlim-add-rlimit-entry-for-posix-mqueue-allocation arch/um/kernel/init_task.c
--- 25/arch/um/kernel/init_task.c~rlim-add-rlimit-entry-for-posix-mqueue-allocation	Wed May 19 15:16:00 2004
+++ 25-akpm/arch/um/kernel/init_task.c	Wed May 19 15:16:00 2004
@@ -9,6 +9,7 @@
 #include "linux/sched.h"
 #include "linux/init_task.h"
 #include "linux/version.h"
+#include "linux/mqueue.h"
 #include "asm/uaccess.h"
 #include "asm/pgtable.h"
 #include "user_util.h"
diff -puN arch/v850/kernel/init_task.c~rlim-add-rlimit-entry-for-posix-mqueue-allocation arch/v850/kernel/init_task.c
--- 25/arch/v850/kernel/init_task.c~rlim-add-rlimit-entry-for-posix-mqueue-allocation	Wed May 19 15:16:00 2004
+++ 25-akpm/arch/v850/kernel/init_task.c	Wed May 19 15:16:00 2004
@@ -15,6 +15,7 @@
 #include <linux/init.h>
 #include <linux/init_task.h>
 #include <linux/fs.h>
+#include <linux/mqueue.h>
 
 #include <asm/uaccess.h>
 #include <asm/pgtable.h>
diff -puN arch/x86_64/kernel/init_task.c~rlim-add-rlimit-entry-for-posix-mqueue-allocation arch/x86_64/kernel/init_task.c
--- 25/arch/x86_64/kernel/init_task.c~rlim-add-rlimit-entry-for-posix-mqueue-allocation	Wed May 19 15:16:00 2004
+++ 25-akpm/arch/x86_64/kernel/init_task.c	Wed May 19 15:16:00 2004
@@ -4,6 +4,7 @@
 #include <linux/init.h>
 #include <linux/init_task.h>
 #include <linux/fs.h>
+#include <linux/mqueue.h>
 
 #include <asm/uaccess.h>
 #include <asm/pgtable.h>
diff -puN include/asm-alpha/resource.h~rlim-add-rlimit-entry-for-posix-mqueue-allocation include/asm-alpha/resource.h
--- 25/include/asm-alpha/resource.h~rlim-add-rlimit-entry-for-posix-mqueue-allocation	Wed May 19 15:16:00 2004
+++ 25-akpm/include/asm-alpha/resource.h	Wed May 19 15:16:00 2004
@@ -17,8 +17,9 @@
 #define RLIMIT_MEMLOCK	9		/* max locked-in-memory address space */
 #define RLIMIT_LOCKS	10		/* maximum file locks held */
 #define RLIMIT_SIGPENDING 11		/* max number of pending signals */
+#define RLIMIT_MSGQUEUE 12		/* maximum bytes in POSIX mqueues */
 
-#define RLIM_NLIMITS	12
+#define RLIM_NLIMITS	13
 
 /*
  * SuS says limits have to be unsigned.  Fine, it's unsigned, but
@@ -43,6 +44,7 @@
     {LONG_MAX, LONG_MAX},			/* RLIMIT_MEMLOCK */	\
     {LONG_MAX, LONG_MAX},			/* RLIMIT_LOCKS */	\
     {MAX_SIGPENDING, MAX_SIGPENDING},		/* RLIMIT_SIGPENDING */ \
+    {MQ_BYTES_MAX, MQ_BYTES_MAX},		/* RLIMIT_MSGQUEUE */	\
 }
 
 #endif /* __KERNEL__ */
diff -puN include/asm-arm26/resource.h~rlim-add-rlimit-entry-for-posix-mqueue-allocation include/asm-arm26/resource.h
--- 25/include/asm-arm26/resource.h~rlim-add-rlimit-entry-for-posix-mqueue-allocation	Wed May 19 15:16:00 2004
+++ 25-akpm/include/asm-arm26/resource.h	Wed May 19 15:16:00 2004
@@ -17,8 +17,9 @@
 #define RLIMIT_AS	9		/* address space limit */
 #define RLIMIT_LOCKS	10		/* maximum file locks held */
 #define RLIMIT_SIGPENDING 11		/* max number of pending signals */
+#define RLIMIT_MSGQUEUE 12		/* maximum bytes in POSIX mqueues */
 
-#define RLIM_NLIMITS	12
+#define RLIM_NLIMITS	13
 
 #ifdef __KERNEL__
 
@@ -42,6 +43,7 @@
 	{ RLIM_INFINITY, RLIM_INFINITY },	\
 	{ RLIM_INFINITY, RLIM_INFINITY },	\
 	{ MAX_SIGPENDING, MAX_SIGPENDING},	\
+	{ MQ_BYTES_MAX, MQ_BYTES_MAX},		\
 }
 
 #endif /* __KERNEL__ */
diff -puN include/asm-arm/resource.h~rlim-add-rlimit-entry-for-posix-mqueue-allocation include/asm-arm/resource.h
--- 25/include/asm-arm/resource.h~rlim-add-rlimit-entry-for-posix-mqueue-allocation	Wed May 19 15:16:00 2004
+++ 25-akpm/include/asm-arm/resource.h	Wed May 19 15:16:00 2004
@@ -17,8 +17,9 @@
 #define RLIMIT_AS	9		/* address space limit */
 #define RLIMIT_LOCKS	10		/* maximum file locks held */
 #define RLIMIT_SIGPENDING 11		/* max number of pending signals */
+#define RLIMIT_MSGQUEUE 12		/* maximum bytes in POSIX mqueues */
 
-#define RLIM_NLIMITS	12
+#define RLIM_NLIMITS	13
 
 #ifdef __KERNEL__
 
@@ -42,6 +43,7 @@
 	{ RLIM_INFINITY, RLIM_INFINITY },	\
 	{ RLIM_INFINITY, RLIM_INFINITY },	\
 	{ MAX_SIGPENDING, MAX_SIGPENDING},	\
+	{ MQ_BYTES_MAX, MQ_BYTES_MAX},		\
 }
 
 #endif /* __KERNEL__ */
diff -puN include/asm-cris/resource.h~rlim-add-rlimit-entry-for-posix-mqueue-allocation include/asm-cris/resource.h
--- 25/include/asm-cris/resource.h~rlim-add-rlimit-entry-for-posix-mqueue-allocation	Wed May 19 15:16:00 2004
+++ 25-akpm/include/asm-cris/resource.h	Wed May 19 15:16:00 2004
@@ -17,8 +17,9 @@
 #define RLIMIT_AS	9		/* address space limit */
 #define RLIMIT_LOCKS	10		/* maximum file locks held */
 #define RLIMIT_SIGPENDING 11		/* max number of pending signals */
+#define RLIMIT_MSGQUEUE 12		/* maximum bytes in POSIX mqueues */
 
-#define RLIM_NLIMITS	12
+#define RLIM_NLIMITS	13
 
 /*
  * SuS says limits have to be unsigned.
@@ -42,6 +43,7 @@
 	{ RLIM_INFINITY, RLIM_INFINITY },		\
 	{ RLIM_INFINITY, RLIM_INFINITY },		\
 	{ MAX_SIGPENDING, MAX_SIGPENDING },		\
+	{ MQ_BYTES_MAX, MQ_BYTES_MAX },			\
 }
 
 #endif /* __KERNEL__ */
diff -puN include/asm-h8300/resource.h~rlim-add-rlimit-entry-for-posix-mqueue-allocation include/asm-h8300/resource.h
--- 25/include/asm-h8300/resource.h~rlim-add-rlimit-entry-for-posix-mqueue-allocation	Wed May 19 15:16:00 2004
+++ 25-akpm/include/asm-h8300/resource.h	Wed May 19 15:16:00 2004
@@ -17,8 +17,9 @@
 #define RLIMIT_AS	9		/* address space limit */
 #define RLIMIT_LOCKS	10		/* maximum file locks held */
 #define RLIMIT_SIGPENDING 11		/* max number of pending signals */
+#define RLIMIT_MSGQUEUE 12		/* maximum bytes in POSIX mqueues */
 
-#define RLIM_NLIMITS	12
+#define RLIM_NLIMITS	13
 
 /*
  * SuS says limits have to be unsigned.
@@ -42,6 +43,7 @@
 	{ RLIM_INFINITY, RLIM_INFINITY },		\
 	{ RLIM_INFINITY, RLIM_INFINITY },		\
 	{ MAX_SIGPENDING, MAX_SIGPENDING },		\
+	{ MQ_BYTES_MAX, MQ_BYTES_MAX },			\
 }
 
 #endif /* __KERNEL__ */
diff -puN include/asm-i386/resource.h~rlim-add-rlimit-entry-for-posix-mqueue-allocation include/asm-i386/resource.h
--- 25/include/asm-i386/resource.h~rlim-add-rlimit-entry-for-posix-mqueue-allocation	Wed May 19 15:16:00 2004
+++ 25-akpm/include/asm-i386/resource.h	Wed May 19 15:16:00 2004
@@ -17,8 +17,9 @@
 #define RLIMIT_AS	9		/* address space limit */
 #define RLIMIT_LOCKS	10		/* maximum file locks held */
 #define RLIMIT_SIGPENDING 11		/* max number of pending signals */
+#define RLIMIT_MSGQUEUE 12		/* maximum bytes in POSIX mqueues */
 
-#define RLIM_NLIMITS	12
+#define RLIM_NLIMITS	13
 
 
 /*
@@ -43,6 +44,7 @@
 	{ RLIM_INFINITY, RLIM_INFINITY },		\
 	{ RLIM_INFINITY, RLIM_INFINITY },		\
 	{ MAX_SIGPENDING, MAX_SIGPENDING },		\
+	{ MQ_BYTES_MAX, MQ_BYTES_MAX },			\
 }
 
 #endif /* __KERNEL__ */
diff -puN include/asm-ia64/resource.h~rlim-add-rlimit-entry-for-posix-mqueue-allocation include/asm-ia64/resource.h
--- 25/include/asm-ia64/resource.h~rlim-add-rlimit-entry-for-posix-mqueue-allocation	Wed May 19 15:16:00 2004
+++ 25-akpm/include/asm-ia64/resource.h	Wed May 19 15:16:00 2004
@@ -24,8 +24,9 @@
 #define RLIMIT_AS	9		/* address space limit */
 #define RLIMIT_LOCKS	10		/* maximum file locks held */
 #define RLIMIT_SIGPENDING 11		/* max number of pending signals */
+#define RLIMIT_MSGQUEUE 12		/* maximum bytes in POSIX mqueues */
 
-#define RLIM_NLIMITS	12
+#define RLIM_NLIMITS	13
 
 /*
  * SuS says limits have to be unsigned.
@@ -49,6 +50,7 @@
 	{ RLIM_INFINITY, RLIM_INFINITY },		\
 	{ RLIM_INFINITY, RLIM_INFINITY },		\
 	{ MAX_SIGPENDING, MAX_SIGPENDING },		\
+	{ MQ_BYTES_MAX, MQ_BYTES_MAX },			\
 }
 
 # endif /* __KERNEL__ */
diff -puN include/asm-m68k/resource.h~rlim-add-rlimit-entry-for-posix-mqueue-allocation include/asm-m68k/resource.h
--- 25/include/asm-m68k/resource.h~rlim-add-rlimit-entry-for-posix-mqueue-allocation	Wed May 19 15:16:00 2004
+++ 25-akpm/include/asm-m68k/resource.h	Wed May 19 15:16:00 2004
@@ -17,8 +17,9 @@
 #define RLIMIT_AS	9		/* address space limit */
 #define RLIMIT_LOCKS	10		/* maximum file locks held */
 #define RLIMIT_SIGPENDING 11		/* max number of pending signals */
+#define RLIMIT_MSGQUEUE 12		/* maximum bytes in POSIX mqueues */
 
-#define RLIM_NLIMITS	12
+#define RLIM_NLIMITS	13
 
 /*
  * SuS says limits have to be unsigned.
@@ -42,6 +43,7 @@
 	{ RLIM_INFINITY, RLIM_INFINITY },		\
 	{ RLIM_INFINITY, RLIM_INFINITY },		\
 	{ MAX_SIGPENDING, MAX_SIGPENDING },		\
+	{ MQ_BYTES_MAX, MQ_BYTES_MAX },			\
 }
 
 #endif /* __KERNEL__ */
diff -puN include/asm-mips/resource.h~rlim-add-rlimit-entry-for-posix-mqueue-allocation include/asm-mips/resource.h
--- 25/include/asm-mips/resource.h~rlim-add-rlimit-entry-for-posix-mqueue-allocation	Wed May 19 15:16:00 2004
+++ 25-akpm/include/asm-mips/resource.h	Wed May 19 15:16:00 2004
@@ -24,8 +24,9 @@
 #define RLIMIT_MEMLOCK 9		/* max locked-in-memory address space */
 #define RLIMIT_LOCKS 10			/* maximum file locks held */
 #define RLIMIT_SIGPENDING 11		/* max number of pending signals */
+#define RLIMIT_MSGQUEUE 12		/* maximum bytes in POSIX mqueues */
 
-#define RLIM_NLIMITS 12			/* Number of limit flavors.  */
+#define RLIM_NLIMITS 13			/* Number of limit flavors.  */
 
 #ifdef __KERNEL__
 
@@ -56,6 +57,7 @@
 	{ RLIM_INFINITY, RLIM_INFINITY },		\
 	{ RLIM_INFINITY, RLIM_INFINITY },		\
 	{ MAX_SIGPENDING, MAX_SIGPENDING },		\
+	{ MQ_BYTES_MAX, MQ_BYTES_MAX },			\
 }
 
 #endif /* __KERNEL__ */
diff -puN include/asm-parisc/resource.h~rlim-add-rlimit-entry-for-posix-mqueue-allocation include/asm-parisc/resource.h
--- 25/include/asm-parisc/resource.h~rlim-add-rlimit-entry-for-posix-mqueue-allocation	Wed May 19 15:16:00 2004
+++ 25-akpm/include/asm-parisc/resource.h	Wed May 19 15:16:00 2004
@@ -17,8 +17,9 @@
 #define RLIMIT_AS	9		/* address space limit */
 #define RLIMIT_LOCKS	10		/* maximum file locks held */
 #define RLIMIT_SIGPENDING 11		/* max number of pending signals */
+#define RLIMIT_MSGQUEUE 12		/* maximum bytes in POSIX mqueues */
 
-#define RLIM_NLIMITS	12
+#define RLIM_NLIMITS	13
 
 /*
  * SuS says limits have to be unsigned.
@@ -42,6 +43,7 @@
 	{ RLIM_INFINITY, RLIM_INFINITY },		\
 	{ RLIM_INFINITY, RLIM_INFINITY },		\
 	{ MAX_SIGPENDING, MAX_SIGPENDING },		\
+	{ MQ_BYTES_MAX, MQ_BYTES_MAX },			\
 }
 
 #endif /* __KERNEL__ */
diff -puN include/asm-ppc64/resource.h~rlim-add-rlimit-entry-for-posix-mqueue-allocation include/asm-ppc64/resource.h
--- 25/include/asm-ppc64/resource.h~rlim-add-rlimit-entry-for-posix-mqueue-allocation	Wed May 19 15:16:00 2004
+++ 25-akpm/include/asm-ppc64/resource.h	Wed May 19 15:16:00 2004
@@ -22,8 +22,9 @@
 #define RLIMIT_AS	9		/* address space limit(?) */
 #define RLIMIT_LOCKS	10		/* maximum file locks held */
 #define RLIMIT_SIGPENDING 11		/* max number of pending signals */
+#define RLIMIT_MSGQUEUE 12		/* maximum bytes in POSIX mqueues */
 
-#define RLIM_NLIMITS	12
+#define RLIM_NLIMITS	13
 
 #ifdef __KERNEL__
 
@@ -48,6 +49,7 @@
 	{ RLIM_INFINITY, RLIM_INFINITY },		\
 	{ RLIM_INFINITY, RLIM_INFINITY },		\
 	{ MAX_SIGPENDING, MAX_SIGPENDING },		\
+	{ MQ_BYTES_MAX, MQ_BYTES_MAX },			\
 }
 
 #endif /* __KERNEL__ */
diff -puN include/asm-ppc/resource.h~rlim-add-rlimit-entry-for-posix-mqueue-allocation include/asm-ppc/resource.h
--- 25/include/asm-ppc/resource.h~rlim-add-rlimit-entry-for-posix-mqueue-allocation	Wed May 19 15:16:00 2004
+++ 25-akpm/include/asm-ppc/resource.h	Wed May 19 15:16:00 2004
@@ -13,8 +13,9 @@
 #define RLIMIT_AS	9		/* address space limit(?) */
 #define RLIMIT_LOCKS	10		/* maximum file locks held */
 #define RLIMIT_SIGPENDING 11		/* max number of pending signals */
+#define RLIMIT_MSGQUEUE 12		/* maximum bytes in POSIX mqueues */
 
-#define RLIM_NLIMITS	12
+#define RLIM_NLIMITS	13
 
 #ifdef __KERNEL__
 
@@ -39,6 +40,7 @@
 	{ RLIM_INFINITY, RLIM_INFINITY },		\
 	{ RLIM_INFINITY, RLIM_INFINITY },		\
 	{ MAX_SIGPENDING, MAX_SIGPENDING },		\
+	{ MQ_BYTES_MAX, MQ_BYTES_MAX },			\
 }
 
 #endif /* __KERNEL__ */
diff -puN include/asm-s390/resource.h~rlim-add-rlimit-entry-for-posix-mqueue-allocation include/asm-s390/resource.h
--- 25/include/asm-s390/resource.h~rlim-add-rlimit-entry-for-posix-mqueue-allocation	Wed May 19 15:16:00 2004
+++ 25-akpm/include/asm-s390/resource.h	Wed May 19 15:16:00 2004
@@ -25,8 +25,9 @@
 #define RLIMIT_AS	9		/* address space limit */
 #define RLIMIT_LOCKS	10		/* maximum file locks held */
 #define RLIMIT_SIGPENDING 11		/* max number of pending signals */
+#define RLIMIT_MSGQUEUE 12		/* maximum bytes in POSIX mqueues */
 
-#define RLIM_NLIMITS	12
+#define RLIM_NLIMITS	13
 
 /*
  * SuS says limits have to be unsigned.
@@ -50,6 +51,7 @@
 	{ RLIM_INFINITY, RLIM_INFINITY },		\
 	{ RLIM_INFINITY, RLIM_INFINITY },		\
 	{ MAX_SIGPENDING, MAX_SIGPENDING },		\
+	{ MQ_BYTES_MAX, MQ_BYTES_MAX },			\
 }
 
 #endif /* __KERNEL__ */
diff -puN include/asm-sh/resource.h~rlim-add-rlimit-entry-for-posix-mqueue-allocation include/asm-sh/resource.h
--- 25/include/asm-sh/resource.h~rlim-add-rlimit-entry-for-posix-mqueue-allocation	Wed May 19 15:16:00 2004
+++ 25-akpm/include/asm-sh/resource.h	Wed May 19 15:16:00 2004
@@ -17,8 +17,9 @@
 #define RLIMIT_AS	9		/* address space limit */
 #define RLIMIT_LOCKS	10		/* maximum file locks held */
 #define RLIMIT_SIGPENDING 11		/* max number of pending signals */
+#define RLIMIT_MSGQUEUE 12		/* maximum bytes in POSIX mqueues */
 
-#define RLIM_NLIMITS	12
+#define RLIM_NLIMITS	13
 
 #ifdef __KERNEL__
 
@@ -42,6 +43,7 @@
 	{ RLIM_INFINITY, RLIM_INFINITY },		\
 	{ RLIM_INFINITY, RLIM_INFINITY },		\
 	{ MAX_SIGPENDING, MAX_SIGPENDING },		\
+	{ MQ_BYTES_MAX, MQ_BYTES_MAX },			\
 }
 
 #endif /* __KERNEL__ */
diff -puN include/asm-sparc64/resource.h~rlim-add-rlimit-entry-for-posix-mqueue-allocation include/asm-sparc64/resource.h
--- 25/include/asm-sparc64/resource.h~rlim-add-rlimit-entry-for-posix-mqueue-allocation	Wed May 19 15:16:00 2004
+++ 25-akpm/include/asm-sparc64/resource.h	Wed May 19 15:16:00 2004
@@ -23,8 +23,9 @@
 #define RLIMIT_AS	9		/* address space limit */
 #define RLIMIT_LOCKS	10		/* maximum file locks held */
 #define RLIMIT_SIGPENDING 11		/* max number of pending signals */
+#define RLIMIT_MSGQUEUE 12		/* maximum bytes in POSIX mqueues */
 
-#define RLIM_NLIMITS	12
+#define RLIM_NLIMITS	13
 
 /*
  * SuS says limits have to be unsigned.
@@ -46,6 +47,7 @@
     {RLIM_INFINITY, RLIM_INFINITY},	\
     {RLIM_INFINITY, RLIM_INFINITY},	\
     {MAX_SIGPENDING, MAX_SIGPENDING},	\
+    {MQ_BYTES_MAX, MQ_BYTES_MAX},	\
 }
 
 #endif /* __KERNEL__ */
diff -puN include/asm-sparc/resource.h~rlim-add-rlimit-entry-for-posix-mqueue-allocation include/asm-sparc/resource.h
--- 25/include/asm-sparc/resource.h~rlim-add-rlimit-entry-for-posix-mqueue-allocation	Wed May 19 15:16:00 2004
+++ 25-akpm/include/asm-sparc/resource.h	Wed May 19 15:16:00 2004
@@ -23,8 +23,9 @@
 #define RLIMIT_AS	9		/* address space limit */
 #define RLIMIT_LOCKS	10		/* maximum file locks held */
 #define RLIMIT_SIGPENDING 11		/* max number of pending signals */
+#define RLIMIT_MSGQUEUE 12		/* maximum bytes in POSIX mqueues */
 
-#define RLIM_NLIMITS	12
+#define RLIM_NLIMITS	13
 
 /*
  * SuS says limits have to be unsigned.
@@ -47,6 +48,7 @@
     {RLIM_INFINITY, RLIM_INFINITY},	\
     {RLIM_INFINITY, RLIM_INFINITY},	\
     {MAX_SIGPENDING, MAX_SIGPENDING},	\
+    {MQ_BYTES_MAX, MQ_BYTES_MAX},	\
 }
 
 #endif /* __KERNEL__ */
diff -puN include/asm-v850/resource.h~rlim-add-rlimit-entry-for-posix-mqueue-allocation include/asm-v850/resource.h
--- 25/include/asm-v850/resource.h~rlim-add-rlimit-entry-for-posix-mqueue-allocation	Wed May 19 15:16:00 2004
+++ 25-akpm/include/asm-v850/resource.h	Wed May 19 15:16:00 2004
@@ -17,8 +17,9 @@
 #define RLIMIT_AS	9		/* address space limit */
 #define RLIMIT_LOCKS	10		/* maximum file locks held */
 #define RLIMIT_SIGPENDING 11		/* max number of pending signals */
+#define RLIMIT_MSGQUEUE 12		/* maximum bytes in POSIX mqueues */
 
-#define RLIM_NLIMITS	12
+#define RLIM_NLIMITS	13
 
 /*
  * SuS says limits have to be unsigned.
@@ -42,6 +43,7 @@
 	{ RLIM_INFINITY, RLIM_INFINITY },		\
 	{ RLIM_INFINITY, RLIM_INFINITY },		\
 	{ MAX_SIGPENDING, MAX_SIGPENDING },		\
+	{ MQ_BYTES_MAX, MQ_BYTES_MAX },			\
 }
 
 #endif /* __KERNEL__ */
diff -puN include/asm-x86_64/resource.h~rlim-add-rlimit-entry-for-posix-mqueue-allocation include/asm-x86_64/resource.h
--- 25/include/asm-x86_64/resource.h~rlim-add-rlimit-entry-for-posix-mqueue-allocation	Wed May 19 15:16:00 2004
+++ 25-akpm/include/asm-x86_64/resource.h	Wed May 19 15:16:00 2004
@@ -17,8 +17,9 @@
 #define RLIMIT_AS	9		/* address space limit */
 #define RLIMIT_LOCKS	10		/* maximum file locks held */
 #define RLIMIT_SIGPENDING 11		/* max number of pending signals */
+#define RLIMIT_MSGQUEUE 12		/* maximum bytes in POSIX mqueues */
 
-#define RLIM_NLIMITS	12
+#define RLIM_NLIMITS	13
 
 /*
  * SuS says limits have to be unsigned.
@@ -42,6 +43,7 @@
 	{ RLIM_INFINITY, RLIM_INFINITY },		\
 	{ RLIM_INFINITY, RLIM_INFINITY },		\
 	{ MAX_SIGPENDING, MAX_SIGPENDING },		\
+	{ MQ_BYTES_MAX, MQ_BYTES_MAX },			\
 }
 
 #endif /* __KERNEL__ */
diff -puN include/linux/mqueue.h~rlim-add-rlimit-entry-for-posix-mqueue-allocation include/linux/mqueue.h
--- 25/include/linux/mqueue.h~rlim-add-rlimit-entry-for-posix-mqueue-allocation	Wed May 19 15:16:00 2004
+++ 25-akpm/include/linux/mqueue.h	Wed May 19 15:16:00 2004
@@ -21,6 +21,8 @@
 #include <linux/types.h>
 
 #define MQ_PRIO_MAX 	32768
+/* per-uid limit of kernel memory used by mqueue, in bytes */
+#define MQ_BYTES_MAX	819200
 
 struct mq_attr {
 	long	mq_flags;	/* message queue flags			*/
diff -puN arch/cris/kernel/process.c~rlim-add-rlimit-entry-for-posix-mqueue-allocation arch/cris/kernel/process.c
--- 25/arch/cris/kernel/process.c~rlim-add-rlimit-entry-for-posix-mqueue-allocation	Wed May 19 15:16:05 2004
+++ 25-akpm/arch/cris/kernel/process.c	Wed May 19 15:16:05 2004
@@ -102,6 +102,7 @@
 #include <linux/fs.h>
 #include <linux/user.h>
 #include <linux/elfcore.h>
+#include <linux/mqueue.h>
 
 //#define DEBUG
 
diff -puN arch/m68k/kernel/process.c~rlim-add-rlimit-entry-for-posix-mqueue-allocation arch/m68k/kernel/process.c
--- 25/arch/m68k/kernel/process.c~rlim-add-rlimit-entry-for-posix-mqueue-allocation	Wed May 19 15:16:05 2004
+++ 25-akpm/arch/m68k/kernel/process.c	Wed May 19 15:16:05 2004
@@ -26,6 +26,7 @@
 #include <linux/a.out.h>
 #include <linux/reboot.h>
 #include <linux/init_task.h>
+#include <linux/mqueue.h>
 
 #include <asm/uaccess.h>
 #include <asm/system.h>
diff -puN arch/ppc/kernel/process.c~rlim-add-rlimit-entry-for-posix-mqueue-allocation arch/ppc/kernel/process.c
--- 25/arch/ppc/kernel/process.c~rlim-add-rlimit-entry-for-posix-mqueue-allocation	Wed May 19 15:16:05 2004
+++ 25-akpm/arch/ppc/kernel/process.c	Wed May 19 15:16:05 2004
@@ -35,6 +35,7 @@
 #include <linux/init_task.h>
 #include <linux/module.h>
 #include <linux/kallsyms.h>
+#include <linux/mqueue.h>
 
 #include <asm/pgtable.h>
 #include <asm/uaccess.h>

_
