summaryrefslogtreecommitdiff
path: root/Src/Builtins/rlimits.c
diff options
context:
space:
mode:
authorAxel Beckert <abe@deuxchevaux.org>2013-11-07 14:52:31 +0100
committerAxel Beckert <abe@deuxchevaux.org>2013-11-07 14:52:31 +0100
commitd799ac78a744a5359563af55b4dee9e91255a1dc (patch)
tree73475ed7089e6ee050085a96b88018994b43bdfc /Src/Builtins/rlimits.c
parentabfb3b136a4ad5b2832fb7d920442a2bb28c0697 (diff)
parent375115c7dfd6dff576915d25fe2ecdd381dd9d81 (diff)
downloadzsh-d799ac78a744a5359563af55b4dee9e91255a1dc.tar.gz
zsh-d799ac78a744a5359563af55b4dee9e91255a1dc.zip
Merge branch 'upstream' into debian
Diffstat (limited to 'Src/Builtins/rlimits.c')
-rw-r--r--Src/Builtins/rlimits.c56
1 files changed, 44 insertions, 12 deletions
diff --git a/Src/Builtins/rlimits.c b/Src/Builtins/rlimits.c
index eedfa969c..fd4c94aaa 100644
--- a/Src/Builtins/rlimits.c
+++ b/Src/Builtins/rlimits.c
@@ -32,6 +32,14 @@
#if defined(HAVE_GETRLIMIT) && defined(RLIM_INFINITY)
+#ifdef RLIMIT_POSIXLOCKS
+# define RLIMIT_LOCKS RLIMIT_POSIXLOCKS
+#endif
+
+#ifdef RLIMIT_NTHR
+# define RLIMIT_PTHREAD RLIMIT_NTHR
+#endif
+
enum {
ZLIMTYPE_MEMORY,
ZLIMTYPE_NUMBER,
@@ -314,12 +322,6 @@ printulimit(char *nam, int lim, int hard, int head)
printf("-u: processes ");
break;
# endif /* HAVE_RLIMIT_NPROC */
-# ifdef HAVE_RLIMIT_NTHR
- case RLIMIT_NTHR:
- if (head)
- printf("-r: threads ");
- break;
-#endif /* HAVE_RLIMIT_NTHR */
# if defined(HAVE_RLIMIT_VMEM) && (!defined(HAVE_RLIMIT_RSS) || !defined(RLIMIT_VMEM_IS_RSS))
case RLIMIT_VMEM:
if (head)
@@ -371,7 +373,7 @@ printulimit(char *nam, int lim, int hard, int head)
# ifdef HAVE_RLIMIT_PTHREAD
case RLIMIT_PTHREAD:
if (head)
- printf("-N %2d: threads per process ", RLIMIT_PTHREAD);
+ printf("-T: threads per process ");
break;
# endif /* HAVE_RLIMIT_PTHREAD */
# ifdef HAVE_RLIMIT_NICE
@@ -386,6 +388,26 @@ printulimit(char *nam, int lim, int hard, int head)
printf("-r: max rt priority ");
break;
# endif /* HAVE_RLIMIT_RTPRIO */
+# 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 size (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);
@@ -800,11 +822,6 @@ bin_ulimit(char *name, char **argv, UNUSED(Options ops), UNUSED(int func))
res = RLIMIT_NOFILE;
break;
# endif /* HAVE_RLIMIT_NOFILE */
-# ifdef HAVE_RLIMIT_NTHR
- case 'r':
- res = RLIMIT_NTHR;
- break;
-# endif /* HAVE_RLIMIT_NTHR */
# ifdef HAVE_RLIMIT_NPROC
case 'u':
res = RLIMIT_NPROC;
@@ -844,6 +861,21 @@ bin_ulimit(char *name, char **argv, UNUSED(Options ops), UNUSED(int func))
res = RLIMIT_RTPRIO;
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);