aboutsummaryrefslogtreecommitdiffstats
path: root/res/res_limit.c
diff options
context:
space:
mode:
authorfile <file@f38db490-d61c-443f-a65b-d21fe96a405b>2006-12-19 21:59:33 +0000
committerfile <file@f38db490-d61c-443f-a65b-d21fe96a405b>2006-12-19 21:59:33 +0000
commit6d7392e30cc4c33d887606af817db7fb9d0fd0a0 (patch)
tree7ae1c718903f288c62ba4f7111d4251e3f96ff44 /res/res_limit.c
parentd1a63929177717c9ce782dfa6e7db45641e3f746 (diff)
OpenBSD does not have RLIMIT_AS or RLIMIT_VMEM so until someone finds the right rlimit to use then let's not support the -v option on OpenBSD. (issue #8543 reported by jtodd)
git-svn-id: http://svn.digium.com/svn/asterisk/trunk@48591 f38db490-d61c-443f-a65b-d21fe96a405b
Diffstat (limited to 'res/res_limit.c')
-rw-r--r--res/res_limit.c16
1 files changed, 13 insertions, 3 deletions
diff --git a/res/res_limit.c b/res/res_limit.c
index 4db463d6e..d76ad4003 100644
--- a/res/res_limit.c
+++ b/res/res_limit.c
@@ -25,6 +25,15 @@
#include "asterisk/module.h"
#include "asterisk/cli.h"
+/* Find proper rlimit for virtual memory */
+#ifdef RLIMIT_AS
+#define VMEM_DEF RLIMIT_AS
+#else
+#ifdef RLIMIT_VMEM
+#define VMEM_DEF RLIMIT_VMEM
+#endif
+#endif
+
static struct limits {
int resource;
char limit[3];
@@ -41,10 +50,9 @@ static struct limits {
{ RLIMIT_MEMLOCK, "-l", "amount of memory locked into RAM" },
#endif
{ RLIMIT_NOFILE, "-n", "number of file descriptors" },
-#ifndef RLIMIT_AS /* *BSD use RLIMIT_VMEM */
-#define RLIMIT_AS RLIMIT_VMEM
+#ifdef VMEM_DEF
+ { VMEM_DEF, "-v", "virtual memory" },
#endif
- { RLIMIT_AS, "-v", "virtual memory" },
};
static int str2limit(const char *string)
@@ -143,7 +151,9 @@ static const char ulimit_usage[] =
" -s Process stack size [readonly]\n"
" -t CPU usage [readonly]\n"
" -u Child processes\n"
+#ifdef VMEM_DEF
" -v Process virtual memory [readonly]\n"
+#endif
" -c Core dump file size\n"
" -n Number of file descriptors\n";