about summary refs log tree commit diff
diff options
context:
space:
mode:
-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;