Mercurial > hg > xemacs-beta
comparison src/mem-limits.h @ 412:697ef44129c6 r21-2-14
Import from CVS: tag r21-2-14
author | cvs |
---|---|
date | Mon, 13 Aug 2007 11:20:41 +0200 |
parents | de805c49cfc1 |
children |
comparison
equal
deleted
inserted
replaced
411:12e008d41344 | 412:697ef44129c6 |
---|---|
25 HAVE_SYS_RESOURCE_H, HAVE_ULIMIT_H, HAVE_GETRLIMIT, HAVE_ULIMIT, | 25 HAVE_SYS_RESOURCE_H, HAVE_ULIMIT_H, HAVE_GETRLIMIT, HAVE_ULIMIT, |
26 and select action based on those values. | 26 and select action based on those values. |
27 getrlimit() should be preferred to ulimit(). | 27 getrlimit() should be preferred to ulimit(). |
28 On Linux, ulimit() is deprecated and always returns -1. */ | 28 On Linux, ulimit() is deprecated and always returns -1. */ |
29 | 29 |
30 #ifndef INCLUDED_mem_limits_h_ | 30 #ifndef _XEMACS_MEM_LIMITS_H_ |
31 #define INCLUDED_mem_limits_h_ | 31 #define _XEMACS_MEM_LIMITS_H_ |
32 | 32 |
33 #ifdef HAVE_CONFIG_H | 33 #ifdef HAVE_CONFIG_H |
34 #include <config.h> | 34 #include <config.h> |
35 #endif | 35 #endif |
36 | 36 |
37 #ifdef HAVE_ULIMIT_H | 37 #ifdef HAVE_ULIMIT_H |
38 #include <ulimit.h> | 38 #include <ulimit.h> |
39 #endif | |
40 | |
41 #ifdef MSDOS | |
42 #include <dpmi.h> | |
39 #endif | 43 #endif |
40 | 44 |
41 /* Some systems need this before <sys/resource.h>. */ | 45 /* Some systems need this before <sys/resource.h>. */ |
42 #include <sys/types.h> | 46 #include <sys/types.h> |
43 | 47 |
64 #endif /*Added by Fukui*/ | 68 #endif /*Added by Fukui*/ |
65 #endif | 69 #endif |
66 | 70 |
67 #ifndef BSD4_2 | 71 #ifndef BSD4_2 |
68 #ifndef USG | 72 #ifndef USG |
69 #ifndef WIN32_NATIVE | 73 #ifndef MSDOS |
70 #ifndef CYGWIN | 74 #ifndef WINDOWSNT |
75 #ifndef __CYGWIN32__ | |
71 #if defined(__linux__) && defined(powerpc) /*Added Kaoru Fukui*/ | 76 #if defined(__linux__) && defined(powerpc) /*Added Kaoru Fukui*/ |
72 #else /*Added Kaoru Fukui*/ | 77 #else /*Added Kaoru Fukui*/ |
73 #include <sys/vlimit.h> | 78 #include <sys/vlimit.h> |
74 #endif /*Added by Fukui*/ | 79 #endif /*Added by Fukui*/ |
75 #endif /* not CYGWIN */ | 80 #endif /* not __CYGWIN32__ */ |
76 #endif /* not WIN32_NATIVE */ | 81 #endif /* not WINDOWSNT */ |
82 #endif /* not MSDOS */ | |
77 #endif /* not USG */ | 83 #endif /* not USG */ |
78 #else /* if BSD4_2 */ | 84 #else /* if BSD4_2 */ |
79 #include <sys/time.h> | 85 #include <sys/time.h> |
80 #include <sys/resource.h> | 86 #include <sys/resource.h> |
81 #endif /* BSD4_2 */ | 87 #endif /* BSD4_2 */ |
88 typedef void *POINTER; | 94 typedef void *POINTER; |
89 #else | 95 #else |
90 typedef char *POINTER; | 96 typedef char *POINTER; |
91 #endif | 97 #endif |
92 | 98 |
93 #ifndef CYGWIN | 99 #ifndef __CYGWIN32__ |
94 typedef unsigned long SIZE; | 100 typedef unsigned long SIZE; |
95 #endif | 101 #endif |
96 | 102 |
97 extern POINTER start_of_data (void); | 103 extern POINTER start_of_data (void); |
98 #define EXCEEDS_LISP_PTR(ptr) 0 | 104 #define EXCEEDS_LISP_PTR(ptr) 0 |
99 | 105 |
100 #ifdef BSD | 106 #ifdef BSD |
107 #ifndef DATA_SEG_BITS | |
101 extern int etext; | 108 extern int etext; |
102 #define start_of_data() &etext | 109 #define start_of_data() &etext |
110 #endif | |
103 #endif | 111 #endif |
104 | 112 |
105 #else /* not emacs */ | 113 #else /* not emacs */ |
106 extern char etext; | 114 extern char etext; |
107 #define start_of_data() &etext | 115 #define start_of_data() &etext |
115 static POINTER data_space_start; | 123 static POINTER data_space_start; |
116 | 124 |
117 /* Number of bytes of writable memory we can expect to be able to get */ | 125 /* Number of bytes of writable memory we can expect to be able to get */ |
118 extern unsigned int lim_data; | 126 extern unsigned int lim_data; |
119 | 127 |
120 #if defined (HEAP_IN_DATA) && !defined(PDUMP) | 128 #ifdef HEAP_IN_DATA |
121 extern unsigned long static_heap_size; | 129 extern unsigned long static_heap_size; |
122 extern int initialized; | 130 extern int initialized; |
123 static void | 131 static void |
124 get_lim_data (void) | 132 get_lim_data (void) |
125 { | 133 { |
161 | 169 |
162 lim_data -= (long) data_space_start; | 170 lim_data -= (long) data_space_start; |
163 } | 171 } |
164 | 172 |
165 #else /* not USG */ | 173 #else /* not USG */ |
166 #if defined( WIN32_NATIVE ) | 174 #if defined( WINDOWSNT ) |
167 | 175 |
168 static void | 176 static void |
169 get_lim_data (void) | 177 get_lim_data (void) |
170 { | 178 { |
171 extern unsigned long data_region_size; | 179 extern unsigned long data_region_size; |
173 } | 181 } |
174 | 182 |
175 #else | 183 #else |
176 #if !defined (BSD4_2) && !defined (__osf__) | 184 #if !defined (BSD4_2) && !defined (__osf__) |
177 | 185 |
186 #ifdef MSDOS | |
187 void | |
188 get_lim_data (void) | |
189 { | |
190 _go32_dpmi_meminfo info; | |
191 | |
192 _go32_dpmi_get_free_memory_information (&info); | |
193 lim_data = info.available_memory; | |
194 } | |
195 #else /* not MSDOS */ | |
178 static void | 196 static void |
179 get_lim_data (void) | 197 get_lim_data (void) |
180 { | 198 { |
181 lim_data = vlimit (LIM_DATA, -1); | 199 lim_data = vlimit (LIM_DATA, -1); |
182 } | 200 } |
201 #endif /* not MSDOS */ | |
183 | 202 |
184 #else /* BSD4_2 */ | 203 #else /* BSD4_2 */ |
185 | 204 |
186 static void | 205 static void |
187 get_lim_data (void) | 206 get_lim_data (void) |
194 #else | 213 #else |
195 lim_data = XXrlimit.rlim_cur; /* soft limit */ | 214 lim_data = XXrlimit.rlim_cur; /* soft limit */ |
196 #endif | 215 #endif |
197 } | 216 } |
198 #endif /* BSD4_2 */ | 217 #endif /* BSD4_2 */ |
199 #endif /* not WIN32_NATIVE */ | 218 #endif /* not WINDOWSNT */ |
200 #endif /* not USG */ | 219 #endif /* not USG */ |
201 #endif /* not NO_LIM_DATA */ | 220 #endif /* not NO_LIM_DATA */ |
202 #endif /* not HEAP_IN_DATA */ | 221 #endif /* not HEAP_IN_DATA */ |
203 | 222 |
204 #endif /* INCLUDED_mem_limits_h_ */ | 223 #endif /* _XEMACS_MEM_LIMITS_H_ */ |