1 /* Includes for memory limit warnings.
2 Copyright (C) 1990, 1993 Free Software Foundation, Inc.
5 This file is part of the GNU C Library.
7 The GNU C Library is free software; you can redistribute it and/or
8 modify it under the terms of the GNU Library General Public License as
9 published by the Free Software Foundation; either version 2 of the
10 License, or (at your option) any later version.
12 The GNU C Library is distributed in the hope that it will be useful,
13 but WITHOUT ANY WARRANTY; without even the implied warranty of
14 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
15 Library General Public License for more details.
17 You should have received a copy of the GNU Library General Public
18 License along with the GNU C Library; see the file COPYING.LIB. If
19 not, write to the Free Software Foundation, Inc., 675 Mass Ave,
20 Cambridge, MA 02139, USA. */
22 #if defined(__osf__) && (defined(__mips) || defined(mips))
24 #include <sys/resource.h>
27 #if defined(__bsdi__) || defined(__NetBSD__)
33 #include <sys/vlimit.h>
37 #include <sys/resource.h>
41 /* The important properties of this type are that 1) it's a pointer, and
42 2) arithmetic on it should work as if the size of the object pointed
43 to has a size of 1. */
45 typedef void *POINTER
;
47 typedef char *POINTER
;
50 typedef unsigned long SIZE
;
55 #define NULL ((POINTER) 0)
57 extern POINTER
start_of_data ();
59 #define EXCEEDS_LISP_PTR(ptr) \
60 (((unsigned int) (ptr) & ~DATA_SEG_BITS) >> VALBITS)
62 #define EXCEEDS_LISP_PTR(ptr) ((unsigned int) (ptr) >> VALBITS)
68 #define start_of_data() &etext
74 #define start_of_data() &etext
75 #endif /* Not emacs */
79 /* start of data space; can be changed by calling malloc_init */
80 static POINTER data_space_start
;
82 /* Number of bytes of writable memory we can expect to be able to get */
83 static unsigned int lim_data
;
90 extern long ulimit ();
94 /* Use the ulimit call, if we seem to have it. */
95 #if !defined (ULIMIT_BREAK_VALUE) || defined (LINUX)
96 lim_data
= ulimit (3, 0);
99 /* If that didn't work, just use the macro's value. */
100 #ifdef ULIMIT_BREAK_VALUE
102 lim_data
= ULIMIT_BREAK_VALUE
;
105 lim_data
-= (long) data_space_start
;
109 #if !defined(BSD4_2) && !defined(__osf__)
114 lim_data
= vlimit (LIM_DATA
, -1);
122 struct rlimit XXrlimit
;
124 getrlimit (RLIMIT_DATA
, &XXrlimit
);
126 lim_data
= XXrlimit
.rlim_cur
& RLIM_INFINITY
; /* soft limit */
128 lim_data
= XXrlimit
.rlim_cur
; /* soft limit */