changeset 97251:96dac1198131

(check_memory_limits) [HAVE_GETRLIMIT]: Fix calculation of data_size. Use correct type for five_percent.
author Andreas Schwab <schwab@suse.de>
date Sun, 03 Aug 2008 08:52:03 +0000
parents 1533ce04b4b8
children c2be97b488c4
files src/ChangeLog src/vm-limit.c
diffstat 2 files changed, 11 insertions(+), 3 deletions(-) [+]
line wrap: on
line diff
--- a/src/ChangeLog	Sat Aug 02 22:35:21 2008 +0000
+++ b/src/ChangeLog	Sun Aug 03 08:52:03 2008 +0000
@@ -1,3 +1,8 @@
+2008-08-03  Andreas Schwab  <schwab@suse.de>
+
+	* vm-limit.c (check_memory_limits) [HAVE_GETRLIMIT]: Fix
+	calculation of data_size.  Use correct type for five_percent.
+
 2008-08-02  Chong Yidong  <cyd@stupidchicken.com>
 
 	* vm-limit.c (check_memory_limits): Don't use getrlimit on cygwin.
--- a/src/vm-limit.c	Sat Aug 02 22:35:21 2008 +0000
+++ b/src/vm-limit.c	Sun Aug 03 08:52:03 2008 +0000
@@ -148,7 +148,11 @@
   extern POINTER (*__morecore) ();
 
   register POINTER cp;
+#if defined (HAVE_GETRLIMIT) && ! defined (CYGWIN)
+  rlim_t five_percent;
+#else
   unsigned long five_percent;
+#endif
   unsigned long data_size;
   enum warnlevel new_warnlevel;
 
@@ -163,7 +167,6 @@
       || rlimit.rlim_cur > rlimit.rlim_max)
     return;
   five_percent = rlimit.rlim_max / 20;
-  data_size = rlimit.rlim_cur;
 
 #else /* not HAVE_GETRLIMIT */
 
@@ -171,6 +174,8 @@
     get_lim_data ();
   five_percent = lim_data / 20;
 
+#endif /* not HAVE_GETRLIMIT */
+
   /* Find current end of memory and issue warning if getting near max */
 #ifdef REL_ALLOC
   if (real_morecore)
@@ -180,8 +185,6 @@
   cp = (char *) (*__morecore) (0);
   data_size = (char *) cp - (char *) data_space_start;
 
-#endif /* not HAVE_GETRLIMIT */
-
   if (!warn_function)
     return;