about summary refs log tree commit diff
diff options
context:
space:
mode:
authorPeter Stephenson <pws@users.sourceforge.net>2001-10-25 11:18:51 +0000
committerPeter Stephenson <pws@users.sourceforge.net>2001-10-25 11:18:51 +0000
commitbb5d460f51959b924a63a70e9f29d66b4c6a6535 (patch)
treeab55c0ef379845e1a9eb91c9a18769d6b983e87e
parent9494376087cffe7363db1a25fcb4171ed4e1b6fc (diff)
downloadzsh-bb5d460f51959b924a63a70e9f29d66b4c6a6535.tar.gz
zsh-bb5d460f51959b924a63a70e9f29d66b4c6a6535.tar.xz
zsh-bb5d460f51959b924a63a70e9f29d66b4c6a6535.zip
16145: try to handle identical RLIMIT_RSS and RLIMIT_VMEM better.
-rw-r--r--ChangeLog5
-rw-r--r--Src/Builtins/rlimits.c14
2 files changed, 12 insertions, 7 deletions
diff --git a/ChangeLog b/ChangeLog
index dfb0d4c33..6bc01c14f 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,8 @@
+2001-10-25  Peter Stephenson  <pws@csr.com>
+
+	* 16145: Src/Builtins/rlimits.c: try to handle both RLIMITS_VMEM
+	and RLIMITS_RSS, even if they are the same value (c.f. 16033).
+
 2001-10-24  Peter Stephenson  <pws@csr.com>
 
 	* 16130: Doc/.cvsignore, Doc/Zsh/manual.yo: Fix for texi2html
diff --git a/Src/Builtins/rlimits.c b/Src/Builtins/rlimits.c
index 2b03beb37..0df671786 100644
--- a/Src/Builtins/rlimits.c
+++ b/Src/Builtins/rlimits.c
@@ -44,12 +44,6 @@ enum {
 
 # include "rlimits.h"
 
-/* If RLIMIT_VMEM and RLIMIT_RSS are defined and equal, drop support *
- * for RLIMIT_RSS.  Observed on QNX Neutrino 6.1.0.                 */
-#if defined(RLIMIT_RSS) && defined(RLIMIT_VMEM) && (RLIMIT_RSS == RLIMIT_VMEM)
-#undef RLIMIT_RSS
-#endif
-
 # if defined(RLIM_T_IS_QUAD_T) || defined(RLIM_T_IS_LONG_LONG) || defined(RLIM_T_IS_UNSIGNED)
 static rlim_t
 zstrtorlimt(const char *s, char **t, int base)
@@ -174,7 +168,9 @@ printulimit(int lim, int hard, int head)
 	if (limit != RLIM_INFINITY)
 	    limit /= 512;
 	break;
-# ifdef RLIMIT_RSS
+/* If RLIMIT_VMEM and RLIMIT_RSS are defined and equal, avoid *
+ * duplicate case statement.  Observed on QNX Neutrino 6.1.0. */
+# if defined(RLIMIT_RSS) && (!defined(RLIMIT_VMEM) || RLIMIT_VMEM != RLIMIT_RSS)
     case RLIMIT_RSS:
 	if (head)
 	    printf("resident set size (kbytes) ");
@@ -205,7 +201,11 @@ printulimit(int lim, int hard, int head)
 # ifdef RLIMIT_VMEM
     case RLIMIT_VMEM:
 	if (head)
+#  if defined(RLIMIT_RSS) && RLIMIT_VMEM == RLIMIT_RSS
+	    printf("memory size (kb)           ");
+#  else
 	    printf("virtual memory size (kb)   ");
+#  endif
 	if (limit != RLIM_INFINITY)
 	    limit /= 1024;
 	break;