about summary refs log tree commit diff
path: root/Src/Builtins
diff options
context:
space:
mode:
authorStefan Neudorf <BM-2cXppXU4T67w7j6NCir9T1WdzBHmFgBnLj@bitmessage.ch>2013-10-30 02:33:18 +0100
committerPeter Stephenson <p.w.stephenson@ntlworld.com>2013-10-31 20:25:13 +0000
commit790a4fee2b498a80b43605d64f4c81f01501b727 (patch)
treefa9debf9255d87022e4a49d997f5ef66a4f8d4f8 /Src/Builtins
parented01d6e1e889ee3184a86ac6e3af6c6684e3a0be (diff)
downloadzsh-790a4fee2b498a80b43605d64f4c81f01501b727.tar.gz
zsh-790a4fee2b498a80b43605d64f4c81f01501b727.tar.xz
zsh-790a4fee2b498a80b43605d64f4c81f01501b727.zip
31930 / 31934: New limits from BSD.
Avoid clash of uses for ulimit -k.
Diffstat (limited to 'Src/Builtins')
-rw-r--r--Src/Builtins/rlimits.awk4
-rw-r--r--Src/Builtins/rlimits.c46
2 files changed, 50 insertions, 0 deletions
diff --git a/Src/Builtins/rlimits.awk b/Src/Builtins/rlimits.awk
index bf914814d..ccee49e87 100644
--- a/Src/Builtins/rlimits.awk
+++ b/Src/Builtins/rlimits.awk
@@ -55,6 +55,10 @@ BEGIN {limidx = 0}
 	    if (limnam == "NICE") { msg[limnum] = "Nnice" }
 	    if (limnam == "RTPRIO") { msg[limnum] = "Nrt_priority" }
 	    if (limnam == "RTTIME") { msg[limnum] = "Urt_time" }
+	    if (limnam == "POSIXLOCKS") { msg[limnum] = "Nposixlocks" }
+	    if (limnam == "NPTS")    { msg[limnum] = "Npseudoterminals" }
+	    if (limnam == "SWAP")    { msg[limnum] = "Mswapuse" }
+	    if (limnam == "KQUEUES") { msg[limnum] = "Nkqueues" }
         }
     }
 }
diff --git a/Src/Builtins/rlimits.c b/Src/Builtins/rlimits.c
index eedfa969c..a0f294876 100644
--- a/Src/Builtins/rlimits.c
+++ b/Src/Builtins/rlimits.c
@@ -386,6 +386,32 @@ printulimit(char *nam, int lim, int hard, int head)
 	    printf("-r: max rt priority                 ");
 	break;
 # endif /* HAVE_RLIMIT_RTPRIO */
+# ifdef HAVE_RLIMIT_POSIXLOCKS
+    case RLIMIT_POSIXLOCKS:
+	if (head)
+	    printf("-K: posixlocks                      ");
+	break;
+# endif /* HAVE_RLIMIT_POSIXLOCKS */
+# ifdef HAVE_RLIMIT_NPTS
+    case RLIMIT_NPTS:
+	if (head)
+	    printf("-p: pseudo-terminals                ");
+	break;
+# endif /* HAVE_RLIMIT_NPTS */
+# ifdef HAVE_RLIMIT_SWAP
+    case RLIMIT_SWAP:
+	if (head)
+	    printf("-w: swap limit (kbytes)             ");
+	if (limit != RLIM_INFINITY)
+	    limit /= 1024;
+	break;
+# endif /* HAVE_RLIMIT_SWAP */
+# ifdef HAVE_RLIMIT_KQUEUES
+    case RLIMIT_KQUEUES:
+	if (head)
+	    printf("-k: kqueues                         ");
+	break;
+# endif /* HAVE_RLIMIT_KQUEUES */
     default:
 	if (head)
 	    printf("-N %2d:                              ", lim);
@@ -844,6 +870,26 @@ bin_ulimit(char *name, char **argv, UNUSED(Options ops), UNUSED(int func))
 		    res = RLIMIT_RTPRIO;
 		    break;
 # endif
+# ifdef HAVE_RLIMIT_POSIXLOCKS
+		case 'K':
+		    res = RLIMIT_POSIXLOCKS;
+		    break;
+# endif
+# ifdef HAVE_RLIMIT_NPTS
+		case 'p':
+		    res = RLIMIT_NPTS;
+		    break;
+# endif
+# ifdef HAVE_RLIMIT_SWAP
+		case 'w':
+		    res = RLIMIT_SWAP;
+		    break;
+# endif
+# ifdef HAVE_RLIMIT_KQUEUES
+		case 'k':
+		    res = RLIMIT_KQUEUES;
+		    break;
+# endif
 		default:
 		    /* unrecognised limit */
 		    zwarnnam(name, "bad option: -%c", *options);