aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorPaul Eggert2012-12-07 22:56:26 -0800
committerPaul Eggert2012-12-07 22:56:26 -0800
commit7be78020e3baaa73d047af75675ea6c92c1c1fda (patch)
tree8b08777c7980d162178d2cdfdc683f9f14c337f4
parentd983a10b9a070fd8f6d4f48ec44e5514b62feaa6 (diff)
downloademacs-7be78020e3baaa73d047af75675ea6c92c1c1fda.tar.gz
emacs-7be78020e3baaa73d047af75675ea6c92c1c1fda.zip
Simplify get_lim_data.
* admin/CPP-DEFINES (ULIMIT_BREAK_VALUE): Remove. * configure.ac (ULIMIT_BREAK_VALUE): Remove. * src/vm-limit.c (get_lim_data): Combine RLIMIT_AS and RLIMIT_DATA methods. Remove USG and vlimit methods; no longer used these days. Add #error catchall just in case.
-rw-r--r--ChangeLog3
-rw-r--r--admin/CPP-DEFINES1
-rw-r--r--admin/ChangeLog5
-rw-r--r--configure.ac14
-rw-r--r--src/ChangeLog5
-rw-r--r--src/vm-limit.c75
6 files changed, 28 insertions, 75 deletions
diff --git a/ChangeLog b/ChangeLog
index cb63adc41d4..c0ab1e03b70 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,8 @@
12012-12-08 Paul Eggert <eggert@cs.ucla.edu> 12012-12-08 Paul Eggert <eggert@cs.ucla.edu>
2 2
3 Simplify get_lim_data.
4 * configure.ac (ULIMIT_BREAK_VALUE): Remove.
5
3 Assume POSIX 1003.1-1988 or later for signal.h (Bug#13026). 6 Assume POSIX 1003.1-1988 or later for signal.h (Bug#13026).
4 * configure.ac (PTY_OPEN, PTY_TTY_NAME_SPRINTF): 7 * configure.ac (PTY_OPEN, PTY_TTY_NAME_SPRINTF):
5 Use SIGCHLD rather than SIGCLD. 8 Use SIGCHLD rather than SIGCLD.
diff --git a/admin/CPP-DEFINES b/admin/CPP-DEFINES
index b71102960e6..13c3da1745a 100644
--- a/admin/CPP-DEFINES
+++ b/admin/CPP-DEFINES
@@ -429,7 +429,6 @@ TERM
429TIME_WITH_SYS_TIME 429TIME_WITH_SYS_TIME
430TIOCSIGSEND 430TIOCSIGSEND
431TM_IN_SYS_TIME 431TM_IN_SYS_TIME
432ULIMIT_BREAK_VALUE
433UNIX98_PTYS 432UNIX98_PTYS
434USE_TOOLKIT_SCROLL_BARS 433USE_TOOLKIT_SCROLL_BARS
435USG_SUBTTY_WORKS 434USG_SUBTTY_WORKS
diff --git a/admin/ChangeLog b/admin/ChangeLog
index 840c38aeb94..81d85f8f24c 100644
--- a/admin/ChangeLog
+++ b/admin/ChangeLog
@@ -1,3 +1,8 @@
12012-12-08 Paul Eggert <eggert@cs.ucla.edu>
2
3 Simplify get_lim_data.
4 * CPP-DEFINES (ULIMIT_BREAK_VALUE): Remove.
5
12012-12-03 Paul Eggert <eggert@cs.ucla.edu> 62012-12-03 Paul Eggert <eggert@cs.ucla.edu>
2 7
3 Assume POSIX 1003.1-1988 or later for signal.h (Bug#13026). 8 Assume POSIX 1003.1-1988 or later for signal.h (Bug#13026).
diff --git a/configure.ac b/configure.ac
index 9dcd55ae13a..affbf5f750d 100644
--- a/configure.ac
+++ b/configure.ac
@@ -3688,7 +3688,6 @@ case $opsys in
3688esac 3688esac
3689 3689
3690 3690
3691AH_TEMPLATE(ULIMIT_BREAK_VALUE, [Undocumented.])
3692AH_TEMPLATE(TAB3, [Undocumented.]) 3691AH_TEMPLATE(TAB3, [Undocumented.])
3693 3692
3694case $opsys in 3693case $opsys in
@@ -3700,14 +3699,6 @@ case $opsys in
3700 ;; 3699 ;;
3701 3700
3702 gnu-linux | gnu-kfreebsd ) 3701 gnu-linux | gnu-kfreebsd )
3703 dnl libc-linux/sysdeps/linux/i386/ulimit.c says that due to shared
3704 dnl library, we cannot get the maximum address for brk.
3705 AC_PREPROC_IFELSE([AC_LANG_PROGRAM([[
3706#ifndef __i386__
3707# error "not i386"
3708#endif
3709 ]], [[]])], AC_DEFINE(ULIMIT_BREAK_VALUE, [(32*1024*1024)]), [])
3710
3711 AC_PREPROC_IFELSE([AC_LANG_PROGRAM([[ 3702 AC_PREPROC_IFELSE([AC_LANG_PROGRAM([[
3712#ifndef __ia64__ 3703#ifndef __ia64__
3713# error "not ia64" 3704# error "not ia64"
@@ -3721,11 +3712,6 @@ case $opsys in
3721 AC_DEFINE(RUN_TIME_REMAP, 1, [Define if emacs.c needs to call 3712 AC_DEFINE(RUN_TIME_REMAP, 1, [Define if emacs.c needs to call
3722 run_time_remap; for HPUX.]) 3713 run_time_remap; for HPUX.])
3723 ;; 3714 ;;
3724
3725 irix6-5)
3726 dnl Ulimit(UL_GMEMLIM) is busted...
3727 AC_DEFINE(ULIMIT_BREAK_VALUE, [0x14000000])
3728 ;;
3729esac 3715esac
3730 3716
3731 3717
diff --git a/src/ChangeLog b/src/ChangeLog
index 2b283a609e3..218dd425a2d 100644
--- a/src/ChangeLog
+++ b/src/ChangeLog
@@ -1,5 +1,10 @@
12012-12-08 Paul Eggert <eggert@cs.ucla.edu> 12012-12-08 Paul Eggert <eggert@cs.ucla.edu>
2 2
3 Simplify get_lim_data.
4 * vm-limit.c (get_lim_data): Combine RLIMIT_AS and RLIMIT_DATA methods.
5 Remove USG and vlimit methods; no longer used these days.
6 Add #error catchall just in case.
7
3 Assume POSIX 1003.1-1988 or later for signal.h (Bug#13026). 8 Assume POSIX 1003.1-1988 or later for signal.h (Bug#13026).
4 Exceptions: do not assume SIGCONT, SIGSTOP, SIGTSTP, SIGTTIN, 9 Exceptions: do not assume SIGCONT, SIGSTOP, SIGTSTP, SIGTTIN,
5 SIGTTOU, SIGUSR1, SIGUSR2, as Microsoft platforms lack these. 10 SIGTTOU, SIGUSR1, SIGUSR2, as Microsoft platforms lack these.
diff --git a/src/vm-limit.c b/src/vm-limit.c
index 2a71e88695a..befc01d400f 100644
--- a/src/vm-limit.c
+++ b/src/vm-limit.c
@@ -44,46 +44,26 @@ static POINTER data_space_start;
44static size_t lim_data; 44static size_t lim_data;
45 45
46 46
47#if defined (HAVE_GETRLIMIT) && defined (RLIMIT_AS) 47#ifdef HAVE_GETRLIMIT
48static void
49get_lim_data (void)
50{
51 struct rlimit rlimit;
52
53 getrlimit (RLIMIT_AS, &rlimit);
54 if (rlimit.rlim_cur == RLIM_INFINITY)
55 lim_data = -1;
56 else
57 lim_data = rlimit.rlim_cur;
58}
59 48
60#else /* not HAVE_GETRLIMIT */ 49# ifndef RLIMIT_AS
61 50# define RLIMIT_AS RLIMIT_DATA
62#ifdef USG 51# endif
63 52
64static void 53static void
65get_lim_data (void) 54get_lim_data (void)
66{ 55{
67 extern long ulimit (); 56 /* Set LIM_DATA to the minimum of the maximum object size and the
68 57 maximum address space. Don't bother to check for values like
69 lim_data = -1; 58 RLIM_INFINITY since in practice they are not much less than SIZE_MAX. */
70 59 struct rlimit rlimit;
71 /* Use the ulimit call, if we seem to have it. */ 60 lim_data
72#if !defined (ULIMIT_BREAK_VALUE) || defined (GNU_LINUX) 61 = (getrlimit (RLIMIT_AS, &rlimit) == 0 && rlimit.rlim_cur <= SIZE_MAX
73 lim_data = ulimit (3, 0); 62 ? rlimit.rlim_cur
74#endif 63 : SIZE_MAX);
75
76 /* If that didn't work, just use the macro's value. */
77#ifdef ULIMIT_BREAK_VALUE
78 if (lim_data == -1)
79 lim_data = ULIMIT_BREAK_VALUE;
80#endif
81
82 lim_data -= (long) data_space_start;
83} 64}
84 65
85#else /* not USG */ 66#elif defined WINDOWSNT
86#ifdef WINDOWSNT
87 67
88#include "w32heap.h" 68#include "w32heap.h"
89 69
@@ -94,10 +74,8 @@ get_lim_data (void)
94 lim_data = reserved_heap_size; 74 lim_data = reserved_heap_size;
95} 75}
96 76
97#else 77#elif defined MSDOS
98#if !defined (BSD4_2) && !defined (CYGWIN)
99 78
100#ifdef MSDOS
101void 79void
102get_lim_data (void) 80get_lim_data (void)
103{ 81{
@@ -135,32 +113,9 @@ ret_lim_data (void)
135 get_lim_data (); 113 get_lim_data ();
136 return lim_data; 114 return lim_data;
137} 115}
138#else /* not MSDOS */
139static void
140get_lim_data (void)
141{
142 lim_data = vlimit (LIM_DATA, -1);
143}
144#endif /* not MSDOS */
145
146#else /* BSD4_2 || CYGWIN */
147
148static void
149get_lim_data (void)
150{
151 struct rlimit XXrlimit;
152
153 getrlimit (RLIMIT_DATA, &XXrlimit);
154#ifdef RLIM_INFINITY
155 lim_data = XXrlimit.rlim_cur & RLIM_INFINITY; /* soft limit */
156#else 116#else
157 lim_data = XXrlimit.rlim_cur; /* soft limit */ 117# error "get_lim_data not implemented on this machine"
158#endif 118#endif
159}
160#endif /* BSD4_2 */
161#endif /* not WINDOWSNT */
162#endif /* not USG */
163#endif /* not HAVE_GETRLIMIT */
164 119
165/* Verify amount of memory available, complaining if we're near the end. */ 120/* Verify amount of memory available, complaining if we're near the end. */
166 121