summaryrefslogtreecommitdiff
path: root/os_dep.c
diff options
context:
space:
mode:
authorivmai <ivmai>2011-07-05 19:53:24 +0200
committerIvan Maidanski <ivmai@mail.ru>2011-07-26 19:07:00 +0200
commit0e57ad67def39d7b672577499346103a4a19bdf8 (patch)
tree568dcefb3bc31e7b66dac6e518758a8daba5b5e4 /os_dep.c
parentd0f043893c60075690a974e41901fb7a878cad3d (diff)
2011-07-05 Ivan Maidanski <ivmai@mail.ru>
* misc.c (GC_init): Use HOTTER_THAN (instead of STACK_GROWS_DOWN) for GC_stackbottom assertion. * os_dep.c (GC_enclosing_mapping): Define only if IA64 or INCLUDE_LINUX_THREAD_DESCR; make GC_INNER. * pthread_support.c (GC_enclosing_mapping): Declare (only if INCLUDE_LINUX_THREAD_DESCR). * os_dep.c (GC_get_main_stack_base): Don't call pthread_getattr_np if REDIRECT_MALLOC as the former is observed to call redirected malloc (while GC is not initialized yet) on some Linux platforms. * include/private/gc_priv.h (MAX_HEAP_SECTS): Don't use a smaller value for SMALL_CONFIG if USE_PROC_FOR_LIBRARIES defined.
Diffstat (limited to 'os_dep.c')
-rw-r--r--os_dep.c56
1 files changed, 30 insertions, 26 deletions
diff --git a/os_dep.c b/os_dep.c
index 73b4939..2d73340 100644
--- a/os_dep.c
+++ b/os_dep.c
@@ -349,34 +349,37 @@ GC_INNER char *GC_parse_map_entry(char *buf_ptr, ptr_t *start, ptr_t *end,
return p;
}
-/* Try to read the backing store base from /proc/self/maps. */
-/* Return the bounds of the writable mapping with a 0 major device, */
-/* which includes the address passed as data. */
-/* Return FALSE if there is no such mapping. */
-GC_bool GC_enclosing_mapping(ptr_t addr, ptr_t *startp, ptr_t *endp)
-{
- char *prot;
- ptr_t my_start, my_end;
- unsigned int maj_dev;
- char *maps = GC_get_maps();
- char *buf_ptr = maps;
+#if defined(IA64) || defined(INCLUDE_LINUX_THREAD_DESCR)
+ /* Try to read the backing store base from /proc/self/maps. */
+ /* Return the bounds of the writable mapping with a 0 major device, */
+ /* which includes the address passed as data. */
+ /* Return FALSE if there is no such mapping. */
+ GC_INNER GC_bool GC_enclosing_mapping(ptr_t addr, ptr_t *startp,
+ ptr_t *endp)
+ {
+ char *prot;
+ ptr_t my_start, my_end;
+ unsigned int maj_dev;
+ char *maps = GC_get_maps();
+ char *buf_ptr = maps;
- if (0 == maps) return(FALSE);
- for (;;) {
- buf_ptr = GC_parse_map_entry(buf_ptr, &my_start, &my_end,
- &prot, &maj_dev, 0);
-
- if (buf_ptr == NULL) return FALSE;
- if (prot[1] == 'w' && maj_dev == 0) {
- if (my_end > addr && my_start <= addr) {
- *startp = my_start;
- *endp = my_end;
- return TRUE;
- }
+ if (0 == maps) return(FALSE);
+ for (;;) {
+ buf_ptr = GC_parse_map_entry(buf_ptr, &my_start, &my_end,
+ &prot, &maj_dev, 0);
+
+ if (buf_ptr == NULL) return FALSE;
+ if (prot[1] == 'w' && maj_dev == 0) {
+ if (my_end > addr && my_start <= addr) {
+ *startp = my_start;
+ *endp = my_end;
+ return TRUE;
+ }
+ }
}
+ return FALSE;
}
- return FALSE;
-}
+#endif /* IA64 || INCLUDE_LINUX_THREAD_DESCR */
#if defined(REDIRECT_MALLOC)
/* Find the text(code) mapping for the library whose name, after */
@@ -1144,7 +1147,8 @@ GC_INNER word GC_page_size = 0;
{
ptr_t result; /* also used as "dummy" to get the approx. sp value */
# if defined(LINUX) && !defined(NACL) \
- && (defined(USE_GET_STACKBASE_FOR_MAIN) || defined(THREADS))
+ && (defined(USE_GET_STACKBASE_FOR_MAIN) \
+ || (defined(THREADS) && !defined(REDIRECT_MALLOC)))
pthread_attr_t attr;
void *stackaddr;
size_t size;