annotate src/mem-limits.h @ 4691:3ba90c659d01

Move Qfrom_unicode to general-slots.h, fix the native Win32 build. 2009-09-20 Aidan Kehoe <kehoea@parhasard.net> * general-slots.h: * mule-coding.c (syms_of_mule_coding): * mule-charset.c (syms_of_mule_charset): Move Qfrom_unicode to general-slots.h, now it's used in more than one file. Fixes the native Win32 build; thank you Vin!
author Aidan Kehoe <kehoea@parhasard.net>
date Sun, 20 Sep 2009 08:27:42 +0100
parents 702b5727498a
children 308d34e9f07d
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1 /* Includes for memory limit warnings.
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2 Copyright (C) 1990, 1992, 1993, 1994, 1995 Free Software Foundation, Inc.
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
3
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
4 This file is part of XEmacs.
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
5
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
6 XEmacs is free software; you can redistribute it and/or modify it
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
7 under the terms of the GNU General Public License as published by the
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
8 Free Software Foundation; either version 2, or (at your option) any
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
9 later version.
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
10
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
11 XEmacs is distributed in the hope that it will be useful, but WITHOUT
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
12 ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
13 FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
14 for more details.
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
15
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
16 You should have received a copy of the GNU General Public License
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
17 along with XEmacs; see the file COPYING. If not, write to
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
18 the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
19 Boston, MA 02111-1307, USA. */
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
20
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
21 /* Synched up with: FSF 19.30. */
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
22
2263
702b5727498a [xemacs-hg @ 2004-09-11 05:28:11 by malcolmp]
malcolmp
parents: 2132
diff changeset
23 /* Subsequently cleaned up and reorganised, made to use configure. */
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
24
440
8de8e3f6228a Import from CVS: tag r21-2-28
cvs
parents: 428
diff changeset
25 #ifndef INCLUDED_mem_limits_h_
8de8e3f6228a Import from CVS: tag r21-2-28
cvs
parents: 428
diff changeset
26 #define INCLUDED_mem_limits_h_
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
27
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
28 #ifdef HAVE_CONFIG_H
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
29 #include <config.h>
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
30 #endif
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
31
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
32 #ifdef HAVE_ULIMIT_H
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
33 #include <ulimit.h>
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
34 #endif
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
35
2263
702b5727498a [xemacs-hg @ 2004-09-11 05:28:11 by malcolmp]
malcolmp
parents: 2132
diff changeset
36 #ifdef HAVE_SYS_RESOURCE_H
702b5727498a [xemacs-hg @ 2004-09-11 05:28:11 by malcolmp]
malcolmp
parents: 2132
diff changeset
37 /* Some systems need either sys/types.h or sys/time.h before <sys/resource.h>. */
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
38 #include <sys/types.h>
2263
702b5727498a [xemacs-hg @ 2004-09-11 05:28:11 by malcolmp]
malcolmp
parents: 2132
diff changeset
39 #include <sys/time.h>
702b5727498a [xemacs-hg @ 2004-09-11 05:28:11 by malcolmp]
malcolmp
parents: 2132
diff changeset
40 #include <sys/resource.h>
702b5727498a [xemacs-hg @ 2004-09-11 05:28:11 by malcolmp]
malcolmp
parents: 2132
diff changeset
41 #endif
702b5727498a [xemacs-hg @ 2004-09-11 05:28:11 by malcolmp]
malcolmp
parents: 2132
diff changeset
42
702b5727498a [xemacs-hg @ 2004-09-11 05:28:11 by malcolmp]
malcolmp
parents: 2132
diff changeset
43 #ifdef HAVE_SYS_VLIMIT_H
702b5727498a [xemacs-hg @ 2004-09-11 05:28:11 by malcolmp]
malcolmp
parents: 2132
diff changeset
44 #include <sys/vlimit.h>
702b5727498a [xemacs-hg @ 2004-09-11 05:28:11 by malcolmp]
malcolmp
parents: 2132
diff changeset
45 #endif
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
46
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
47 #ifdef _LIBC
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
48
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
49 /* Old Linux startup code won't define __data_start. */
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
50 extern int etext, __data_start; weak_symbol (__data_start)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
51 #define start_of_data() (&__data_start ?: &etext)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
52
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
53 #else /* not GNU libc */
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
54
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
55 #ifdef emacs
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
56 typedef void *POINTER;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
57
442
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
58 #ifndef CYGWIN
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
59 typedef unsigned long SIZE;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
60 #endif
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
61
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
62 extern POINTER start_of_data (void);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
63 #define EXCEEDS_LISP_PTR(ptr) 0
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
64
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
65 #ifdef BSD
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
66 extern int etext;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
67 #define start_of_data() &etext
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
68 #endif
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
69
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
70 #else /* not emacs */
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
71 extern char etext;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
72 #define start_of_data() &etext
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
73 #endif /* not emacs */
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
74
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
75 #endif /* not _LIBC */
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
76
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
77
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
78
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
79 /* start of data space; can be changed by calling malloc_init */
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
80 static POINTER data_space_start;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
81
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
82 /* Number of bytes of writable memory we can expect to be able to get */
2132
34ca43a57692 [xemacs-hg @ 2004-06-16 12:01:17 by malcolmp]
malcolmp
parents: 1632
diff changeset
83 extern unsigned long lim_data;
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
84
2263
702b5727498a [xemacs-hg @ 2004-09-11 05:28:11 by malcolmp]
malcolmp
parents: 2132
diff changeset
85 /* The implementation of get_lim_data() is very machine dependent. */
702b5727498a [xemacs-hg @ 2004-09-11 05:28:11 by malcolmp]
malcolmp
parents: 2132
diff changeset
86
442
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
87 #if defined (HEAP_IN_DATA) && !defined(PDUMP)
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
88 extern unsigned long static_heap_size;
1632
64eaceca611d [xemacs-hg @ 2003-08-19 02:07:03 by james]
james
parents: 1204
diff changeset
89 extern MODULE_API int initialized;
2263
702b5727498a [xemacs-hg @ 2004-09-11 05:28:11 by malcolmp]
malcolmp
parents: 2132
diff changeset
90
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
91 static void
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
92 get_lim_data (void)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
93 {
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
94 if (!initialized)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
95 {
2132
34ca43a57692 [xemacs-hg @ 2004-06-16 12:01:17 by malcolmp]
malcolmp
parents: 1632
diff changeset
96 lim_data = (unsigned long) -1; /* static_heap_size; */
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
97 }
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
98 else
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
99 {
2132
34ca43a57692 [xemacs-hg @ 2004-06-16 12:01:17 by malcolmp]
malcolmp
parents: 1632
diff changeset
100 lim_data = (unsigned long) -1;
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
101 }
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
102 }
2263
702b5727498a [xemacs-hg @ 2004-09-11 05:28:11 by malcolmp]
malcolmp
parents: 2132
diff changeset
103
702b5727498a [xemacs-hg @ 2004-09-11 05:28:11 by malcolmp]
malcolmp
parents: 2132
diff changeset
104 #elif defined(NO_LIM_DATA)
702b5727498a [xemacs-hg @ 2004-09-11 05:28:11 by malcolmp]
malcolmp
parents: 2132
diff changeset
105
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
106 static void
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
107 get_lim_data (void)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
108 {
2132
34ca43a57692 [xemacs-hg @ 2004-06-16 12:01:17 by malcolmp]
malcolmp
parents: 1632
diff changeset
109 lim_data = (unsigned long) -1;
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
110 }
2263
702b5727498a [xemacs-hg @ 2004-09-11 05:28:11 by malcolmp]
malcolmp
parents: 2132
diff changeset
111
702b5727498a [xemacs-hg @ 2004-09-11 05:28:11 by malcolmp]
malcolmp
parents: 2132
diff changeset
112 #elif defined(HAVE_GETRLIMIT)
702b5727498a [xemacs-hg @ 2004-09-11 05:28:11 by malcolmp]
malcolmp
parents: 2132
diff changeset
113
702b5727498a [xemacs-hg @ 2004-09-11 05:28:11 by malcolmp]
malcolmp
parents: 2132
diff changeset
114 static void
702b5727498a [xemacs-hg @ 2004-09-11 05:28:11 by malcolmp]
malcolmp
parents: 2132
diff changeset
115 get_lim_data (void)
702b5727498a [xemacs-hg @ 2004-09-11 05:28:11 by malcolmp]
malcolmp
parents: 2132
diff changeset
116 {
702b5727498a [xemacs-hg @ 2004-09-11 05:28:11 by malcolmp]
malcolmp
parents: 2132
diff changeset
117 struct rlimit XXrlimit;
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
118
2263
702b5727498a [xemacs-hg @ 2004-09-11 05:28:11 by malcolmp]
malcolmp
parents: 2132
diff changeset
119 getrlimit (RLIMIT_DATA, &XXrlimit);
702b5727498a [xemacs-hg @ 2004-09-11 05:28:11 by malcolmp]
malcolmp
parents: 2132
diff changeset
120 #ifdef RLIM_INFINITY
702b5727498a [xemacs-hg @ 2004-09-11 05:28:11 by malcolmp]
malcolmp
parents: 2132
diff changeset
121 lim_data = XXrlimit.rlim_cur & RLIM_INFINITY; /* soft limit */
702b5727498a [xemacs-hg @ 2004-09-11 05:28:11 by malcolmp]
malcolmp
parents: 2132
diff changeset
122 #else
702b5727498a [xemacs-hg @ 2004-09-11 05:28:11 by malcolmp]
malcolmp
parents: 2132
diff changeset
123 lim_data = XXrlimit.rlim_cur; /* soft limit */
702b5727498a [xemacs-hg @ 2004-09-11 05:28:11 by malcolmp]
malcolmp
parents: 2132
diff changeset
124 #endif
702b5727498a [xemacs-hg @ 2004-09-11 05:28:11 by malcolmp]
malcolmp
parents: 2132
diff changeset
125 }
702b5727498a [xemacs-hg @ 2004-09-11 05:28:11 by malcolmp]
malcolmp
parents: 2132
diff changeset
126
702b5727498a [xemacs-hg @ 2004-09-11 05:28:11 by malcolmp]
malcolmp
parents: 2132
diff changeset
127 #elif defined(HAVE_ULIMIT)
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
128
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
129 static void
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
130 get_lim_data (void)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
131 {
2132
34ca43a57692 [xemacs-hg @ 2004-06-16 12:01:17 by malcolmp]
malcolmp
parents: 1632
diff changeset
132 lim_data = (unsigned long) -1;
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
133
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
134 /* Use the ulimit call, if we seem to have it. */
2132
34ca43a57692 [xemacs-hg @ 2004-06-16 12:01:17 by malcolmp]
malcolmp
parents: 1632
diff changeset
135 #if !defined (ULIMIT_BREAK_VALUE)
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
136 lim_data = ulimit (3, 0);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
137 #endif
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
138
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
139 /* If that didn't work, just use the macro's value. */
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
140 #ifdef ULIMIT_BREAK_VALUE
2132
34ca43a57692 [xemacs-hg @ 2004-06-16 12:01:17 by malcolmp]
malcolmp
parents: 1632
diff changeset
141 if (lim_data == (unsigned long) -1)
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
142 lim_data = ULIMIT_BREAK_VALUE;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
143 #endif
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
144
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
145 lim_data -= (long) data_space_start;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
146 }
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
147
2263
702b5727498a [xemacs-hg @ 2004-09-11 05:28:11 by malcolmp]
malcolmp
parents: 2132
diff changeset
148 #elif defined(WIN32_NATIVE)
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
149
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
150 static void
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
151 get_lim_data (void)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
152 {
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
153 extern unsigned long data_region_size;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
154 lim_data = data_region_size;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
155 }
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
156
2263
702b5727498a [xemacs-hg @ 2004-09-11 05:28:11 by malcolmp]
malcolmp
parents: 2132
diff changeset
157 #elif defined(HAVE_VLIMIT)
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
158
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
159 static void
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
160 get_lim_data (void)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
161 {
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
162 lim_data = vlimit (LIM_DATA, -1);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
163 }
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
164
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
165 #else
2263
702b5727498a [xemacs-hg @ 2004-09-11 05:28:11 by malcolmp]
malcolmp
parents: 2132
diff changeset
166 #error Cannot determine an implementation of get_lim_data().
702b5727498a [xemacs-hg @ 2004-09-11 05:28:11 by malcolmp]
malcolmp
parents: 2132
diff changeset
167 #endif /* not HAVE_VLIMIT */
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
168
440
8de8e3f6228a Import from CVS: tag r21-2-28
cvs
parents: 428
diff changeset
169 #endif /* INCLUDED_mem_limits_h_ */