summaryrefslogtreecommitdiff
path: root/Src/Builtins/rlimits.c
diff options
context:
space:
mode:
authorAxel Beckert <abe@deuxchevaux.org>2012-12-17 19:50:31 +0100
committerAxel Beckert <abe@deuxchevaux.org>2012-12-17 19:51:41 +0100
commit049f4be0b89188e1bc3e19e75c0675dd2356d3ef (patch)
tree7b6cc1a6611683b28888f8f7172ce8ceba773c30 /Src/Builtins/rlimits.c
parent015e05572733aafd2a005edd507d16e2310653a0 (diff)
parent7152094541a54c92ff937413f850e09412585b7b (diff)
downloadzsh-049f4be0b89188e1bc3e19e75c0675dd2356d3ef.tar.gz
zsh-049f4be0b89188e1bc3e19e75c0675dd2356d3ef.zip
New upstream test release
Diffstat (limited to 'Src/Builtins/rlimits.c')
-rw-r--r--Src/Builtins/rlimits.c72
1 files changed, 43 insertions, 29 deletions
diff --git a/Src/Builtins/rlimits.c b/Src/Builtins/rlimits.c
index 670516169..eedfa969c 100644
--- a/Src/Builtins/rlimits.c
+++ b/Src/Builtins/rlimits.c
@@ -238,32 +238,32 @@ printulimit(char *nam, int lim, int hard, int head)
switch (lim) {
case RLIMIT_CORE:
if (head)
- printf("-c: core file size (blocks) ");
+ printf("-c: core file size (blocks) ");
if (limit != RLIM_INFINITY)
limit /= 512;
break;
case RLIMIT_DATA:
if (head)
- printf("-d: data seg size (kbytes) ");
+ printf("-d: data seg size (kbytes) ");
if (limit != RLIM_INFINITY)
limit /= 1024;
break;
case RLIMIT_FSIZE:
if (head)
- printf("-f: file size (blocks) ");
+ printf("-f: file size (blocks) ");
if (limit != RLIM_INFINITY)
limit /= 512;
break;
# ifdef HAVE_RLIMIT_SIGPENDING
case RLIMIT_SIGPENDING:
if (head)
- printf("-i: pending signals ");
+ printf("-i: pending signals ");
break;
# endif
# ifdef HAVE_RLIMIT_MEMLOCK
case RLIMIT_MEMLOCK:
if (head)
- printf("-l: locked-in-memory size (kb) ");
+ printf("-l: locked-in-memory size (kbytes) ");
if (limit != RLIM_INFINITY)
limit /= 1024;
break;
@@ -273,7 +273,7 @@ printulimit(char *nam, int lim, int hard, int head)
# if defined(HAVE_RLIMIT_RSS) && !defined(RLIMIT_VMEM_IS_RSS) && !defined(RLIMIT_RSS_IS_AS)
case RLIMIT_RSS:
if (head)
- printf("-m: resident set size (kbytes) ");
+ printf("-m: resident set size (kbytes) ");
if (limit != RLIM_INFINITY)
limit /= 1024;
break;
@@ -281,7 +281,7 @@ printulimit(char *nam, int lim, int hard, int head)
# if defined(HAVE_RLIMIT_VMEM) && defined(HAVE_RLIMIT_RSS) && defined(RLIMIT_VMEM_IS_RSS)
case RLIMIT_VMEM:
if (head)
- printf("-m: memory size (kb) ");
+ printf("-m: memory size (kbytes) ");
if (limit != RLIM_INFINITY)
limit /= 1024;
break;
@@ -289,35 +289,41 @@ printulimit(char *nam, int lim, int hard, int head)
# ifdef HAVE_RLIMIT_NOFILE
case RLIMIT_NOFILE:
if (head)
- printf("-n: file descriptors ");
+ printf("-n: file descriptors ");
break;
# endif /* HAVE_RLIMIT_NOFILE */
# ifdef HAVE_RLIMIT_MSGQUEUE
case RLIMIT_MSGQUEUE:
if (head)
- printf("-q: bytes in POSIX msg queues ");
+ printf("-q: bytes in POSIX msg queues ");
break;
# endif
case RLIMIT_STACK:
if (head)
- printf("-s: stack size (kbytes) ");
+ printf("-s: stack size (kbytes) ");
if (limit != RLIM_INFINITY)
limit /= 1024;
break;
case RLIMIT_CPU:
if (head)
- printf("-t: cpu time (seconds) ");
+ printf("-t: cpu time (seconds) ");
break;
# ifdef HAVE_RLIMIT_NPROC
case RLIMIT_NPROC:
if (head)
- printf("-u: processes ");
+ 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)
- printf("-v: virtual memory size (kb) ");
+ printf("-v: virtual memory size (kbytes) ");
if (limit != RLIM_INFINITY)
limit /= 1024;
break;
@@ -325,7 +331,7 @@ printulimit(char *nam, int lim, int hard, int head)
# if defined HAVE_RLIMIT_AS && !defined(RLIMIT_VMEM_IS_AS)
case RLIMIT_AS:
if (head)
- printf("-v: address space (kb) ");
+ printf("-v: address space (kbytes) ");
if (limit != RLIM_INFINITY)
limit /= 1024;
break;
@@ -333,13 +339,13 @@ printulimit(char *nam, int lim, int hard, int head)
# ifdef HAVE_RLIMIT_LOCKS
case RLIMIT_LOCKS:
if (head)
- printf("-x: file locks ");
+ printf("-x: file locks ");
break;
# endif /* HAVE_RLIMIT_LOCKS */
# ifdef HAVE_RLIMIT_AIO_MEM
case RLIMIT_AIO_MEM:
if (head)
- printf("-N %2d: AIO locked-in-memory (kb) ", RLIMIT_AIO_MEM);
+ printf("-N %2d: AIO locked-in-memory (kbytes)", RLIMIT_AIO_MEM);
if (limit != RLIM_INFINITY)
limit /= 1024;
break;
@@ -347,44 +353,42 @@ printulimit(char *nam, int lim, int hard, int head)
# ifdef HAVE_RLIMIT_AIO_OPS
case RLIMIT_AIO_OPS:
if (head)
- printf("-N %2d: AIO operations ", RLIMIT_AIO_OPS);
+ printf("-N %2d: AIO operations ", RLIMIT_AIO_OPS);
break;
# endif /* HAVE_RLIMIT_AIO_OPS */
# ifdef HAVE_RLIMIT_TCACHE
case RLIMIT_TCACHE:
if (head)
- printf("-N %2d: cached threads ", RLIMIT_TCACHE);
+ printf("-N %2d: cached threads ", RLIMIT_TCACHE);
break;
# endif /* HAVE_RLIMIT_TCACHE */
# ifdef HAVE_RLIMIT_SBSIZE
case RLIMIT_SBSIZE:
if (head)
- printf("-N %2d: socket buffer size (kb) ", RLIMIT_SBSIZE);
- if (limit != RLIM_INFINITY)
- limit /= 1024;
+ printf("-b: socket buffer size (bytes) ", RLIMIT_SBSIZE);
break;
# endif /* HAVE_RLIMIT_SBSIZE */
# ifdef HAVE_RLIMIT_PTHREAD
case RLIMIT_PTHREAD:
if (head)
- printf("-N %2d: threads per process ", RLIMIT_PTHREAD);
+ printf("-N %2d: threads per process ", RLIMIT_PTHREAD);
break;
# endif /* HAVE_RLIMIT_PTHREAD */
# ifdef HAVE_RLIMIT_NICE
case RLIMIT_NICE:
if (head)
- printf("-e: max nice ");
+ printf("-e: max nice ");
break;
# endif /* HAVE_RLIMIT_NICE */
# ifdef HAVE_RLIMIT_RTPRIO
case RLIMIT_RTPRIO:
if (head)
- printf("-r: max rt priority ");
+ printf("-r: max rt priority ");
break;
# endif /* HAVE_RLIMIT_RTPRIO */
default:
if (head)
- printf("-N %2d: ", lim);
+ printf("-N %2d: ", lim);
break;
}
/* display the limit */
@@ -776,21 +780,31 @@ bin_ulimit(char *name, char **argv, UNUSED(Options ops), UNUSED(int func))
case 'c':
res = RLIMIT_CORE;
break;
-# ifdef HAVE_RLIMIT_RSS
- case 'm':
- res = RLIMIT_RSS;
+# ifdef HAVE_RLIMIT_SBSIZE
+ case 'b':
+ res = RLIMIT_SBSIZE;
break;
-# endif /* HAVE_RLIMIT_RSS */
+# endif /* HAVE_RLIMIT_SBSIZE */
# ifdef HAVE_RLIMIT_MEMLOCK
case 'l':
res = RLIMIT_MEMLOCK;
break;
# endif /* HAVE_RLIMIT_MEMLOCK */
+# ifdef HAVE_RLIMIT_RSS
+ case 'm':
+ res = RLIMIT_RSS;
+ break;
+# endif /* HAVE_RLIMIT_RSS */
# ifdef HAVE_RLIMIT_NOFILE
case 'n':
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;