From: ivmai Date: Tue, 19 Apr 2011 17:49:22 +0000 (+0000) Subject: 2011-04-19 Ivan Maidanski X-Git-Tag: gc7_2alpha6~60 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=af1726c615b5af04e3fe20b8782c1560aac41f7f;p=gc 2011-04-19 Ivan Maidanski * misc.c (GC_parse_mem_size_arg): New function. * misc.c (GC_init): Use GC_parse_mem_size_arg(). * pthread_stop_world.c (tkill): Declare for Android. --- diff --git a/ChangeLog b/ChangeLog index 9079f5a6..ffc1aa2c 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,9 @@ +2011-04-19 Ivan Maidanski + + * misc.c (GC_parse_mem_size_arg): New function. + * misc.c (GC_init): Use GC_parse_mem_size_arg(). + * pthread_stop_world.c (tkill): Declare for Android. + 2011-04-19 Ivan Maidanski * include/private/gc_priv.h (_GNU_SOURCE): Include features.h diff --git a/misc.c b/misc.c index 51a92483..59bdd127 100644 --- a/misc.c +++ b/misc.c @@ -633,6 +633,14 @@ STATIC void GC_exit_check(void) STATIC int GC_log = 2; /* stderr */ #endif +STATIC word GC_parse_mem_size_arg(const char *str) +{ + char *endptr; + word result = (word)STRTOULL(str, &endptr, 10); + /* TODO: allow 'k', 'M', 'G' suffix */ + return result; +} + GC_INNER void GC_initialize_offsets(void); /* defined in obj_map.c */ GC_INNER void GC_bl_init(void); /* defined in blacklst.c */ @@ -941,7 +949,7 @@ GC_API void GC_CALL GC_init(void) { char * sz_str = GETENV("GC_INITIAL_HEAP_SIZE"); if (sz_str != NULL) { - initial_heap_sz = (word)STRTOULL(sz_str, NULL, 10); + initial_heap_sz = GC_parse_mem_size_arg(sz_str); if (initial_heap_sz <= MINHINCR * HBLKSIZE) { WARN("Bad initial heap size %s - ignoring it.\n", sz_str); } @@ -951,7 +959,7 @@ GC_API void GC_CALL GC_init(void) { char * sz_str = GETENV("GC_MAXIMUM_HEAP_SIZE"); if (sz_str != NULL) { - word max_heap_sz = (word)STRTOULL(sz_str, NULL, 10); + word max_heap_sz = GC_parse_mem_size_arg(sz_str); if (max_heap_sz < initial_heap_sz * HBLKSIZE) { WARN("Bad maximum heap size %s - ignoring it.\n", sz_str); } diff --git a/pthread_stop_world.c b/pthread_stop_world.c index 4ec6fe1f..af0c62e5 100644 --- a/pthread_stop_world.c +++ b/pthread_stop_world.c @@ -375,6 +375,8 @@ GC_INNER void GC_push_all_stacks(void) #endif #ifdef PLATFORM_ANDROID + extern int tkill(pid_t tid, int sig); /* from sys/linux-unistd.h */ + static int android_thread_kill(pid_t tid, int sig) { int ret;