git: 363ea40c7654 - main - limits: Further RLIMIT_VMM cleanup

From: Dag-Erling Smørgrav <des_at_FreeBSD.org>
Date: Sun, 17 May 2026 16:24:12 UTC
The branch main has been updated by des:

URL: https://cgit.FreeBSD.org/src/commit/?id=363ea40c765424b3cbd9b96790235af030fcc8ff

commit 363ea40c765424b3cbd9b96790235af030fcc8ff
Author:     Dag-Erling Smørgrav <des@FreeBSD.org>
AuthorDate: 2026-05-17 16:23:50 +0000
Commit:     Dag-Erling Smørgrav <des@FreeBSD.org>
CommitDate: 2026-05-17 16:23:50 +0000

    limits: Further RLIMIT_VMM cleanup
    
    Teach limits(1), sh(1), and setclassresources(3) about RLIMIT_VMM.
    
    Fixes:          1092ec8b3375 ("kern: Introduce RLIMIT_VMM")
    Reviewed by:    bnovkov
    Differential Revision:  https://reviews.freebsd.org/D57031
---
 bin/sh/miscbltin.c        | 5 ++++-
 lib/libutil/login_class.c | 1 +
 usr.bin/limits/limits.c   | 2 ++
 3 files changed, 7 insertions(+), 1 deletion(-)

diff --git a/bin/sh/miscbltin.c b/bin/sh/miscbltin.c
index bbf0aa5b8bde..f96f96ba43d2 100644
--- a/bin/sh/miscbltin.c
+++ b/bin/sh/miscbltin.c
@@ -517,6 +517,9 @@ static const struct limits limits[] = {
 #endif
 #ifdef RLIMIT_PIPEBUF
 	{ "pipebuf",		(char *)0,	RLIMIT_PIPEBUF, 1024, 'y' },
+#endif
+#ifdef RLIMIT_VMM
+	{ "virtual machines",	(char *)0,	RLIMIT_VMM,	   1, 'V' },
 #endif
 	{ (char *) 0,		(char *)0,	0,		   0, '\0' }
 };
@@ -553,7 +556,7 @@ ulimitcmd(int argc __unused, char **argv __unused)
 	struct rlimit	limit;
 
 	what = 'f';
-	while ((optc = nextopt("HSatfdsmcnuvlbpwkoy")) != '\0')
+	while ((optc = nextopt("abcdfHklmnopSstuVvwy")) != '\0')
 		switch (optc) {
 		case 'H':
 			how = HARD;
diff --git a/lib/libutil/login_class.c b/lib/libutil/login_class.c
index 9478b4dc98ca..90e4e01f7c3b 100644
--- a/lib/libutil/login_class.c
+++ b/lib/libutil/login_class.c
@@ -66,6 +66,7 @@ static struct login_res {
     { "kqueues",         login_getcapsize, RLIMIT_KQUEUES },
     { "umtxp",           login_getcapnum,  RLIMIT_UMTXP   },
     { "pipebuf",         login_getcapnum,  RLIMIT_PIPEBUF },
+    { "vms",             login_getcapnum,  RLIMIT_VMM     },
     { NULL,              0,                0              }
 };
 
diff --git a/usr.bin/limits/limits.c b/usr.bin/limits/limits.c
index 57551c556c25..fbb19289e6ca 100644
--- a/usr.bin/limits/limits.c
+++ b/usr.bin/limits/limits.c
@@ -92,6 +92,7 @@ static struct {
 	  { "  kqueues%-4s          %8s", "\n",       1    },
 	  { "  umtxp%-4s            %8s", "\n",       1    },
 	  { "  pipebuf%-4s          %8s", " kB\n",    1024 },
+	  { "  vms%-4s              %8s", "\n",       1    },
       }
     },
     { "sh", "unlimited", "", " -H", " -S", "",
@@ -112,6 +113,7 @@ static struct {
 	  { "ulimit%s -k %s", ";\n",  1    },
 	  { "ulimit%s -o %s", ";\n",  1    },
 	  { "ulimit%s -y %s", ";\n",  1024 },
+	  { "ulimit%s -V %s", ";\n",  1    },
       }
     },
     { "csh", "unlimited", "", " -h", "", NULL,