From faaa0febefc3de14da204284d79dd60c59a140b2 Mon Sep 17 00:00:00 2001 From: Chris Wright Date: Thu, 17 Jun 2004 17:56:56 -0700 Subject: [PATCH] RLIM: add rlimit entry for POSIX mqueue allocation Add an rlimit entry to control the maximum number of bytes a user can allocate to a POSIX mqueue. Signed-off-by: Andrew Morton Signed-off-by: Linus Torvalds --- include/asm-alpha/resource.h | 4 +++- include/asm-arm/resource.h | 4 +++- include/asm-arm26/resource.h | 4 +++- include/asm-cris/resource.h | 4 +++- include/asm-h8300/resource.h | 4 +++- include/asm-i386/resource.h | 4 +++- include/asm-ia64/resource.h | 4 +++- include/asm-m68k/resource.h | 4 +++- include/asm-mips/resource.h | 4 +++- include/asm-parisc/resource.h | 4 +++- include/asm-ppc/resource.h | 4 +++- include/asm-ppc64/resource.h | 4 +++- include/asm-s390/resource.h | 4 +++- include/asm-sh/resource.h | 4 +++- include/asm-sparc/resource.h | 4 +++- include/asm-sparc64/resource.h | 4 +++- include/asm-v850/resource.h | 4 +++- include/asm-x86_64/resource.h | 4 +++- include/linux/mqueue.h | 2 ++ 19 files changed, 56 insertions(+), 18 deletions(-) (limited to 'include') diff --git a/include/asm-alpha/resource.h b/include/asm-alpha/resource.h index 71d2e693f7d4..b94759c61521 100644 --- a/include/asm-alpha/resource.h +++ b/include/asm-alpha/resource.h @@ -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 --git a/include/asm-arm/resource.h b/include/asm-arm/resource.h index 5b8e15c7f73f..748c660edb15 100644 --- a/include/asm-arm/resource.h +++ b/include/asm-arm/resource.h @@ -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 --git a/include/asm-arm26/resource.h b/include/asm-arm26/resource.h index 5b8e15c7f73f..748c660edb15 100644 --- a/include/asm-arm26/resource.h +++ b/include/asm-arm26/resource.h @@ -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 --git a/include/asm-cris/resource.h b/include/asm-cris/resource.h index 24e84dc536c4..e33ada08d9b8 100644 --- a/include/asm-cris/resource.h +++ b/include/asm-cris/resource.h @@ -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 --git a/include/asm-h8300/resource.h b/include/asm-h8300/resource.h index 7c9af85cc262..a87720b14a90 100644 --- a/include/asm-h8300/resource.h +++ b/include/asm-h8300/resource.h @@ -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 --git a/include/asm-i386/resource.h b/include/asm-i386/resource.h index fbfa5cd7a50f..3e391b2e941f 100644 --- a/include/asm-i386/resource.h +++ b/include/asm-i386/resource.h @@ -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 --git a/include/asm-ia64/resource.h b/include/asm-ia64/resource.h index 8dc4509e1129..76345b5c14c8 100644 --- a/include/asm-ia64/resource.h +++ b/include/asm-ia64/resource.h @@ -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 --git a/include/asm-m68k/resource.h b/include/asm-m68k/resource.h index 74d5eb62597b..8362001c286c 100644 --- a/include/asm-m68k/resource.h +++ b/include/asm-m68k/resource.h @@ -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 --git a/include/asm-mips/resource.h b/include/asm-mips/resource.h index 83ab5709e0e9..2453e0d1c35c 100644 --- a/include/asm-mips/resource.h +++ b/include/asm-mips/resource.h @@ -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 --git a/include/asm-parisc/resource.h b/include/asm-parisc/resource.h index 877629d0ca88..59a446534c5b 100644 --- a/include/asm-parisc/resource.h +++ b/include/asm-parisc/resource.h @@ -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 --git a/include/asm-ppc/resource.h b/include/asm-ppc/resource.h index 457db3c9b51b..3d29914559fc 100644 --- a/include/asm-ppc/resource.h +++ b/include/asm-ppc/resource.h @@ -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 --git a/include/asm-ppc64/resource.h b/include/asm-ppc64/resource.h index 45a61e048b81..c54e9d69d829 100644 --- a/include/asm-ppc64/resource.h +++ b/include/asm-ppc64/resource.h @@ -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 --git a/include/asm-s390/resource.h b/include/asm-s390/resource.h index 1fa59c6aea5a..5f0f2ba958dd 100644 --- a/include/asm-s390/resource.h +++ b/include/asm-s390/resource.h @@ -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 --git a/include/asm-sh/resource.h b/include/asm-sh/resource.h index b6f415d5c1d5..73e517a3e80f 100644 --- a/include/asm-sh/resource.h +++ b/include/asm-sh/resource.h @@ -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 --git a/include/asm-sparc/resource.h b/include/asm-sparc/resource.h index 75bd2d4d1f29..58e90f72ca70 100644 --- a/include/asm-sparc/resource.h +++ b/include/asm-sparc/resource.h @@ -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 --git a/include/asm-sparc64/resource.h b/include/asm-sparc64/resource.h index 9ac4e1ba215b..4a77dd620621 100644 --- a/include/asm-sparc64/resource.h +++ b/include/asm-sparc64/resource.h @@ -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 --git a/include/asm-v850/resource.h b/include/asm-v850/resource.h index 43aac5597d46..9f4ca4ae638f 100644 --- a/include/asm-v850/resource.h +++ b/include/asm-v850/resource.h @@ -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 --git a/include/asm-x86_64/resource.h b/include/asm-x86_64/resource.h index 772134280ae8..9628f77179fd 100644 --- a/include/asm-x86_64/resource.h +++ b/include/asm-x86_64/resource.h @@ -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 --git a/include/linux/mqueue.h b/include/linux/mqueue.h index fc40b774b913..8db9d75541a6 100644 --- a/include/linux/mqueue.h +++ b/include/linux/mqueue.h @@ -21,6 +21,8 @@ #include #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 */ -- cgit v1.2.3