diff options
author | Peter Stephenson <pws@users.sourceforge.net> | 2005-01-19 13:03:33 +0000 |
---|---|---|
committer | Peter Stephenson <pws@users.sourceforge.net> | 2005-01-19 13:03:33 +0000 |
commit | f8d74c1aab6e72172b25caf5a4a15cbbdb46a4f2 (patch) | |
tree | 3c62007e6c41f79e6d5ccaf700ee38fa66c38558 /Src/Builtins | |
parent | 10199323ef41f9e2d4173b7241cb72190994770b (diff) | |
download | zsh-f8d74c1aab6e72172b25caf5a4a15cbbdb46a4f2.tar.gz zsh-f8d74c1aab6e72172b25caf5a4a15cbbdb46a4f2.tar.xz zsh-f8d74c1aab6e72172b25caf5a4a15cbbdb46a4f2.zip |
20728: add RLIMIT_SIGPENDING and RLIMIT_MSGQUEUE,
also use ulimit -x for RLIMIT_LOCK
Diffstat (limited to 'Src/Builtins')
-rw-r--r-- | Src/Builtins/rlimits.awk | 2 | ||||
-rw-r--r-- | Src/Builtins/rlimits.c | 117 |
2 files changed, 76 insertions, 43 deletions
diff --git a/Src/Builtins/rlimits.awk b/Src/Builtins/rlimits.awk index 1a3e5fe77..e1a06fe2b 100644 --- a/Src/Builtins/rlimits.awk +++ b/Src/Builtins/rlimits.awk @@ -45,6 +45,8 @@ BEGIN {limidx = 0} if (limnam == "STACK") { msg[limnum] = "Mstacksize" } if (limnam == "TCACHE") { msg[limnum] = "Ncachedthreads" } if (limnam == "VMEM") { msg[limnum] = "Mvmemorysize" } + if (limnam == "SIGPENDING") { msg[limnum] = "Nsigpending" } + if (limnam == "MSGQUEUE") { msg[limnum] = "Nmsgqueue" } } } } diff --git a/Src/Builtins/rlimits.c b/Src/Builtins/rlimits.c index cabf7975b..9256f25b2 100644 --- a/Src/Builtins/rlimits.c +++ b/Src/Builtins/rlimits.c @@ -208,13 +208,9 @@ printulimit(char *nam, int lim, int hard, int head) limit = (hard) ? limits[lim].rlim_max : limits[lim].rlim_cur; /* display the appropriate heading */ switch (lim) { - case RLIMIT_CPU: - if (head) - printf("-t: cpu time (seconds) "); - break; - case RLIMIT_FSIZE: + case RLIMIT_CORE: if (head) - printf("-f: file size (blocks) "); + printf("-c: core file size (blocks) "); if (limit != RLIM_INFINITY) limit /= 512; break; @@ -224,18 +220,26 @@ printulimit(char *nam, int lim, int hard, int head) if (limit != RLIM_INFINITY) limit /= 1024; break; - case RLIMIT_STACK: + case RLIMIT_FSIZE: if (head) - printf("-s: stack size (kbytes) "); + printf("-f: file size (blocks) "); if (limit != RLIM_INFINITY) - limit /= 1024; + limit /= 512; break; - case RLIMIT_CORE: +# ifdef HAVE_RLIMIT_SIGPENDING + case RLIMIT_SIGPENDING: if (head) - printf("-c: core file size (blocks) "); + printf("-i: pending signals "); + break; +# endif +# ifdef HAVE_RLIMIT_MEMLOCK + case RLIMIT_MEMLOCK: + if (head) + printf("-l: locked-in-memory size (kb) "); if (limit != RLIM_INFINITY) - limit /= 512; + limit /= 1024; break; +# endif /* HAVE_RLIMIT_MEMLOCK */ /* If RLIMIT_VMEM and RLIMIT_RSS are defined and equal, avoid * * duplicate case statement. Observed on QNX Neutrino 6.1.0. */ # if defined(HAVE_RLIMIT_RSS) && !defined(RLIMIT_VMEM_IS_RSS) @@ -246,34 +250,46 @@ printulimit(char *nam, int lim, int hard, int head) limit /= 1024; break; # endif /* HAVE_RLIMIT_RSS */ -# ifdef HAVE_RLIMIT_MEMLOCK - case RLIMIT_MEMLOCK: +# if defined(HAVE_RLIMIT_VMEM) && defined(HAVE_RLIMIT_RSS) && defined(RLIMIT_VMEM_IS_RSS) + case RLIMIT_VMEM: if (head) - printf("-l: locked-in-memory size (kb) "); + printf("-m: memory size (kb) "); if (limit != RLIM_INFINITY) limit /= 1024; break; -# endif /* HAVE_RLIMIT_MEMLOCK */ -# ifdef HAVE_RLIMIT_NPROC - case RLIMIT_NPROC: - if (head) - printf("-u: processes "); - break; -# endif /* HAVE_RLIMIT_NPROC */ +# endif /* HAVE_RLIMIT_VMEM */ # ifdef HAVE_RLIMIT_NOFILE case RLIMIT_NOFILE: if (head) printf("-n: file descriptors "); break; # endif /* HAVE_RLIMIT_NOFILE */ -# ifdef HAVE_RLIMIT_VMEM +# ifdef HAVE_RLIMIT_MSGQUEUE + case RLIMIT_MSGQUEUE: + if (head) + printf("-q: bytes in POSIX msg queues "); + break; +# endif + case RLIMIT_STACK: + if (head) + printf("-s: stack size (kbytes) "); + if (limit != RLIM_INFINITY) + limit /= 1024; + break; + case RLIMIT_CPU: + if (head) + printf("-t: cpu time (seconds) "); + break; +# ifdef HAVE_RLIMIT_NPROC + case RLIMIT_NPROC: + if (head) + printf("-u: processes "); + break; +# endif /* HAVE_RLIMIT_NPROC */ +# if defined(HAVE_RLIMIT_VMEM) && (!defined(HAVE_RLIMIT_RSS) || !defined(RLIMIT_VMEM_IS_RSS)) case RLIMIT_VMEM: if (head) -# if defined(HAVE_RLIMIT_RSS) && defined(RLIMIT_VMEM_IS_RSS) - printf("-m: memory size (kb) "); -# else printf("-v: virtual memory size (kb) "); -# endif if (limit != RLIM_INFINITY) limit /= 1024; break; @@ -286,18 +302,12 @@ printulimit(char *nam, int lim, int hard, int head) limit /= 1024; break; # endif /* HAVE_RLIMIT_AS */ -# ifdef HAVE_RLIMIT_TCACHE - case RLIMIT_TCACHE: - if (head) - printf("-N %2d: cached threads ", RLIMIT_TCACHE); - break; -# endif /* HAVE_RLIMIT_TCACHE */ -# ifdef HAVE_RLIMIT_AIO_OPS - case RLIMIT_AIO_OPS: +# ifdef HAVE_RLIMIT_LOCKS + case RLIMIT_LOCKS: if (head) - printf("-N %2d: AIO operations ", RLIMIT_AIO_OPS); + printf("-x: file locks "); break; -# endif /* HAVE_RLIMIT_AIO_OPS */ +# endif /* HAVE_RLIMIT_LOCKS */ # ifdef HAVE_RLIMIT_AIO_MEM case RLIMIT_AIO_MEM: if (head) @@ -306,6 +316,18 @@ printulimit(char *nam, int lim, int hard, int head) limit /= 1024; break; # endif /* HAVE_RLIMIT_AIO_MEM */ +# ifdef HAVE_RLIMIT_AIO_OPS + case RLIMIT_AIO_OPS: + if (head) + 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); + break; +# endif /* HAVE_RLIMIT_TCACHE */ # ifdef HAVE_RLIMIT_SBSIZE case RLIMIT_SBSIZE: if (head) @@ -320,12 +342,6 @@ printulimit(char *nam, int lim, int hard, int head) printf("-N %2d: threads per process ", RLIMIT_PTHREAD); break; # endif /* HAVE_RLIMIT_PTHREAD */ -# ifdef HAVE_RLIMIT_LOCKS - case RLIMIT_LOCKS: - if (head) - printf("-N %2d: file locks ", RLIMIT_LOCKS); - break; -# endif /* HAVE_RLIMIT_LOCKS */ default: if (head) printf("-N %2d: ", lim); @@ -745,6 +761,21 @@ bin_ulimit(char *name, char **argv, UNUSED(Options ops), UNUSED(int func)) # endif break; # endif /* HAVE_RLIMIT_VMEM */ +# ifdef HAVE_RLIMIT_LOCKS + case 'x': + res = RLIMIT_LOCKS; + break; +# endif +# ifdef HAVE_RLIMIT_SIGPENDING + case 'i': + res = RLIMIT_SIGPENDING; + break; +# endif +# ifdef HAVE_RLIMIT_MSGQUEUE + case 'q': + res = RLIMIT_MSGQUEUE; + break; +# endif default: /* unrecognised limit */ zwarnnam(name, "bad option: -%c", NULL, *options); |