Commit a023b559 authored by Andreas Schwab's avatar Andreas Schwab
Browse files

(check_memory_limits) [HAVE_GETRLIMIT]: Fix

calculation of data_size.  Use correct type for five_percent.
parent 21da04c4
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> 2008-08-02 Chong Yidong <cyd@stupidchicken.com>
* vm-limit.c (check_memory_limits): Don't use getrlimit on cygwin. * vm-limit.c (check_memory_limits): Don't use getrlimit on cygwin.
......
...@@ -148,7 +148,11 @@ check_memory_limits () ...@@ -148,7 +148,11 @@ check_memory_limits ()
extern POINTER (*__morecore) (); extern POINTER (*__morecore) ();
register POINTER cp; register POINTER cp;
#if defined (HAVE_GETRLIMIT) && ! defined (CYGWIN)
rlim_t five_percent;
#else
unsigned long five_percent; unsigned long five_percent;
#endif
unsigned long data_size; unsigned long data_size;
enum warnlevel new_warnlevel; enum warnlevel new_warnlevel;
...@@ -163,7 +167,6 @@ check_memory_limits () ...@@ -163,7 +167,6 @@ check_memory_limits ()
|| rlimit.rlim_cur > rlimit.rlim_max) || rlimit.rlim_cur > rlimit.rlim_max)
return; return;
five_percent = rlimit.rlim_max / 20; five_percent = rlimit.rlim_max / 20;
data_size = rlimit.rlim_cur;
#else /* not HAVE_GETRLIMIT */ #else /* not HAVE_GETRLIMIT */
...@@ -171,6 +174,8 @@ check_memory_limits () ...@@ -171,6 +174,8 @@ check_memory_limits ()
get_lim_data (); get_lim_data ();
five_percent = lim_data / 20; five_percent = lim_data / 20;
#endif /* not HAVE_GETRLIMIT */
/* Find current end of memory and issue warning if getting near max */ /* Find current end of memory and issue warning if getting near max */
#ifdef REL_ALLOC #ifdef REL_ALLOC
if (real_morecore) if (real_morecore)
...@@ -180,8 +185,6 @@ check_memory_limits () ...@@ -180,8 +185,6 @@ check_memory_limits ()
cp = (char *) (*__morecore) (0); cp = (char *) (*__morecore) (0);
data_size = (char *) cp - (char *) data_space_start; data_size = (char *) cp - (char *) data_space_start;
#endif /* not HAVE_GETRLIMIT */
if (!warn_function) if (!warn_function)
return; return;
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment