aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorKonstantin Belousov <kib@FreeBSD.org>2024-09-10 04:13:46 +0000
committerKonstantin Belousov <kib@FreeBSD.org>2024-09-20 06:46:07 +0000
commitf54f41403d149e867b896ae753a0e7e2b0c738b0 (patch)
tree5906dbc295ed65ff14653d44804a7f61f1f82026
parent5d92f20c7d316aca521d4db4c1dab0f2d0e92c36 (diff)
usr.bin/limits: support RLIMIT_PIPEBUF
Sponsored by: The FreeBSD Foundation MFC after: 1 week Differential revision: https://reviews.freebsd.org/D46619
-rw-r--r--usr.bin/limits/limits.16
-rw-r--r--usr.bin/limits/limits.c8
2 files changed, 11 insertions, 3 deletions
diff --git a/usr.bin/limits/limits.1 b/usr.bin/limits/limits.1
index 86df08b41058..0e374acd991b 100644
--- a/usr.bin/limits/limits.1
+++ b/usr.bin/limits/limits.1
@@ -32,7 +32,7 @@
.Nm
.Op Fl C Ar class | Fl U Ar user
.Op Fl SHB
-.Op Fl bcdfklmnopstuvw Op Ar val
+.Op Fl bcdfklmnopstuvwy Op Ar val
.Op Fl E
.Oo
.Op Ar name Ns = Ns Ar value ...
@@ -280,6 +280,10 @@ space.
Select or set the
.Va swapuse
resource limit.
+.It Fl y Op Ar val
+Select or set the
+.Va pipebuf
+resource limit.
.El
.Pp
Valid values for
diff --git a/usr.bin/limits/limits.c b/usr.bin/limits/limits.c
index 68b1853651b9..c53066b52a9f 100644
--- a/usr.bin/limits/limits.c
+++ b/usr.bin/limits/limits.c
@@ -91,6 +91,7 @@ static struct {
{ " swapuse%-4s %8s", " kB\n", 1024 },
{ " kqueues%-4s %8s", "\n", 1 },
{ " umtxp%-4s %8s", "\n", 1 },
+ { " pipebuf%-4s %8s", " kB\n", 1024 },
}
},
{ "sh", "unlimited", "", " -H", " -S", "",
@@ -110,6 +111,7 @@ static struct {
{ "ulimit%s -w %s", ";\n", 1024 },
{ "ulimit%s -k %s", ";\n", 1 },
{ "ulimit%s -o %s", ";\n", 1 },
+ { "ulimit%s -y %s", ";\n", 1024 },
}
},
{ "csh", "unlimited", "", " -h", "", NULL,
@@ -242,6 +244,7 @@ static struct {
{ "swapuse", login_getcapsize },
{ "kqueues", login_getcapnum },
{ "umtxp", login_getcapnum },
+ { "pipebuf", login_getcapnum },
};
/*
@@ -252,7 +255,7 @@ static struct {
* to be modified accordingly!
*/
-#define RCS_STRING "tfdscmlunbvpwko"
+#define RCS_STRING "tfdscmlunbvpwkoy"
static rlim_t resource_num(int which, int ch, const char *str);
static void usage(void) __dead2;
@@ -292,7 +295,7 @@ main(int argc, char *argv[])
pid = -1;
optarg = NULL;
while ((ch = getopt(argc, argv,
- ":EeC:U:BSHP:ab:c:d:f:l:m:n:s:t:u:v:p:w:k:o:")) != -1) {
+ ":EeC:U:BSHP:ab:c:d:f:l:m:n:s:t:u:v:p:w:k:o:y:")) != -1) {
switch(ch) {
case 'a':
doall = 1;
@@ -623,6 +626,7 @@ resource_num(int which, int ch, const char *str)
case RLIMIT_SBSIZE:
case RLIMIT_VMEM:
case RLIMIT_SWAP:
+ case RLIMIT_PIPEBUF:
errno = 0;
res = 0;
while (*s) {