summaryrefslogtreecommitdiffstats
path: root/usr.bin/limits
diff options
context:
space:
mode:
authordillon <dillon@FreeBSD.org>2002-06-26 03:43:25 +0000
committerdillon <dillon@FreeBSD.org>2002-06-26 03:43:25 +0000
commitd5a842607850f23de049e10796c60956f90c402d (patch)
tree5796f1a88ddcfd54858d25118c3993460d00c3f2 /usr.bin/limits
parent0d3a835f3f94caa05448371062a46d2485185ee1 (diff)
downloadFreeBSD-src-d5a842607850f23de049e10796c60956f90c402d.zip
FreeBSD-src-d5a842607850f23de049e10796c60956f90c402d.tar.gz
Make limits(1) aware of the new vmemoryuse resource limit.
Submitted by: sheldonh
Diffstat (limited to 'usr.bin/limits')
-rw-r--r--usr.bin/limits/limits.119
-rw-r--r--usr.bin/limits/limits.c34
2 files changed, 37 insertions, 16 deletions
diff --git a/usr.bin/limits/limits.1 b/usr.bin/limits/limits.1
index 76482af..5aa4803 100644
--- a/usr.bin/limits/limits.1
+++ b/usr.bin/limits/limits.1
@@ -30,11 +30,11 @@
.Op Fl C Ar class
.Op Fl SHB
.Op Fl ea
-.Op Fl cdflmnstu Op val
+.Op Fl cdflmnstuv Op val
.Nm
.Op Fl C Ar class
.Op Fl SHB
-.Op Fl cdflmnstu Op val
+.Op Fl cdflmnstuv Op val
.Op Fl E
.Op Ar name Ns = Ns Ar value ...
.Op Ar command
@@ -42,11 +42,11 @@
.Op Fl U Ar user
.Op Fl SHB
.Op Fl ea
-.Op Fl cdflmnstu Op val
+.Op Fl cdflmnstuv Op val
.Nm
.Op Fl U Ar user
.Op Fl SHB
-.Op Fl cdflmnstu Op val
+.Op Fl cdflmnstuv Op val
.Op Fl E
.Op Ar name Ns = Ns Ar value ...
.Op Ar command
@@ -229,6 +229,17 @@ allowed per UID can be viewed using the 'sysctl kern.maxprocperuid' command.
The maximum number of processes that can be running simultaneously
in the entire system is limited to the value given by
the 'sysctl kern.maxproc' command.
+.It Fl v Op Ar limit
+Select or set the
+.Em virtualmem
+resource limit.
+This limit encompasses the entire VM space for the user process
+and is inclusive of text, data, bss, stack,
+.Xr brk 2 ,
+.Xr sbrk 2
+and
+.Xr mmap 2 Ns 'd
+space.
.El
.Pp
Valid values for
diff --git a/usr.bin/limits/limits.c b/usr.bin/limits/limits.c
index 21db848..6a2a205 100644
--- a/usr.bin/limits/limits.c
+++ b/usr.bin/limits/limits.c
@@ -84,7 +84,8 @@ static struct {
{ " memorylocked%-4s %8s", " kb\n", 1024 },
{ " maxprocesses%-4s %8s", "\n", 1 },
{ " openfiles%-4s %8s", "\n", 1 },
- { " sbsize%-4s %8s", " bytes\n", 1 }
+ { " sbsize%-4s %8s", " bytes\n", 1 },
+ { " vmemoryuse%-4s %8s", " kb\n", 1024 }
}
},
{ "sh", "unlimited", "", " -H", " -S", "",
@@ -98,7 +99,8 @@ static struct {
{ "ulimit%s -l %s", ";\n", 1024 },
{ "ulimit%s -u %s", ";\n", 1 },
{ "ulimit%s -n %s", ";\n", 1 },
- { "ulimit%s -b %s", ";\n", 1 }
+ { "ulimit%s -b %s", ";\n", 1 },
+ { "ulimit%s -v %s", ";\n", 1024 }
}
},
{ "csh", "unlimited", "", " -h", "", NULL,
@@ -112,7 +114,8 @@ static struct {
{ "limit%s memorylocked %s", ";\n", 1024 },
{ "limit%s maxproc %s", ";\n", 1 },
{ "limit%s openfiles %s", ";\n", 1 },
- { "limit%s sbsize %s", ";\n", 1 }
+ { "limit%s sbsize %s", ";\n", 1 },
+ { "limit%s vmemoryuse %s", ";\n", 1024 }
}
},
{ "bash|bash2", "unlimited", "", " -H", " -S", "",
@@ -126,7 +129,8 @@ static struct {
{ "ulimit%s -l %s", ";\n", 1024 },
{ "ulimit%s -u %s", ";\n", 1 },
{ "ulimit%s -n %s", ";\n", 1 },
- { "ulimit%s -b %s", ";\n", 1 }
+ { "ulimit%s -b %s", ";\n", 1 },
+ { "ulimit%s -v %s", ";\n", 1024 }
}
},
{ "tcsh", "unlimited", "", " -h", "", NULL,
@@ -140,7 +144,8 @@ static struct {
{ "limit%s memorylocked %s", ";\n", 1024 },
{ "limit%s maxproc %s", ";\n", 1 },
{ "limit%s descriptors %s", ";\n", 1 },
- { "limit%s sbsize %s", ";\n", 1 }
+ { "limit%s sbsize %s", ";\n", 1 },
+ { "limit%s vmemoryuse %s", ";\n", 1024 }
}
},
{ "ksh|pdksh", "unlimited", "", " -H", " -S", "",
@@ -154,7 +159,8 @@ static struct {
{ "ulimit%s -l %s", ";\n", 1024 },
{ "ulimit%s -p %s", ";\n", 1 },
{ "ulimit%s -n %s", ";\n", 1 },
- { "ulimit%s -b %s", ";\n", 1 }
+ { "ulimit%s -b %s", ";\n", 1 },
+ { "ulimit%s -v %s", ";\n", 1024 }
}
},
{ "zsh", "unlimited", "", " -H", " -S", "",
@@ -168,7 +174,8 @@ static struct {
{ "ulimit%s -l %s", ";\n", 1024 },
{ "ulimit%s -u %s", ";\n", 1 },
{ "ulimit%s -n %s", ";\n", 1 },
- { "ulimit%s -b %s", ";\n", 1 }
+ { "ulimit%s -b %s", ";\n", 1 },
+ { "ulimit%s -v %s", ";\n", 1024 }
}
},
{ "rc|es", "unlimited", "", " -h", "", NULL,
@@ -182,7 +189,8 @@ static struct {
{ "limit%s lockedmemory %s", ";\n", 1024 },
{ "limit%s processes %s", ";\n", 1 },
{ "limit%s descriptors %s", ";\n", 1 },
- { "limit%s sbsize %s", ";\n", 1 }
+ { "limit%s sbsize %s", ";\n", 1 },
+ { "limit%s vmemoryuse %s", ";\n", 1024 }
}
},
{ NULL, NULL, NULL, NULL, NULL, NULL,
@@ -203,7 +211,8 @@ static struct {
{ "memorylocked", login_getcapsize },
{ "maxproc", login_getcapnum },
{ "openfiles", login_getcapnum },
- { "sbsize", login_getcapsize }
+ { "sbsize", login_getcapsize },
+ { "vmemoryuse", login_getcapsize }
};
/*
@@ -214,7 +223,7 @@ static struct {
* to be modified accordingly!
*/
-#define RCS_STRING "tfdscmlunb"
+#define RCS_STRING "tfdscmlunbv"
static rlim_t resource_num(int which, int ch, const char *str);
static void usage(void);
@@ -250,7 +259,7 @@ main(int argc, char *argv[])
}
optarg = NULL;
- while ((ch = getopt(argc, argv, ":EeC:U:BSHabc:d:f:l:m:n:s:t:u:")) != -1) {
+ while ((ch = getopt(argc, argv, ":EeC:U:BSHabc:d:f:l:m:n:s:t:u:v:")) != -1) {
switch(ch) {
case 'a':
doall = 1;
@@ -459,7 +468,7 @@ static void
usage(void)
{
(void)fprintf(stderr,
-"usage: limits [-C class|-U user] [-eaSHBE] [-bcdflmnstu [val]] [[name=val ...] cmd]\n");
+"usage: limits [-C class|-U user] [-eaSHBE] [-bcdflmnstuv [val]] [[name=val ...] cmd]\n");
exit(EXIT_FAILURE);
}
@@ -529,6 +538,7 @@ resource_num(int which, int ch, const char *str)
case RLIMIT_CORE:
case RLIMIT_RSS:
case RLIMIT_MEMLOCK:
+ case RLIMIT_VMEM:
errno = 0;
res = 0;
while (*s) {
OpenPOWER on IntegriCloud