]> granicus.if.org Git - gc/commitdiff
2011-04-19 Ivan Maidanski <ivmai@mail.ru>
authorivmai <ivmai>
Tue, 19 Apr 2011 17:49:22 +0000 (17:49 +0000)
committerIvan Maidanski <ivmai@mail.ru>
Tue, 26 Jul 2011 17:06:58 +0000 (21:06 +0400)
* 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.

ChangeLog
misc.c
pthread_stop_world.c

index 9079f5a63f0b7bf809401678290523d559263662..ffc1aa2c47ca2f93592c050392ce4387d1086cac 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,9 @@
+2011-04-19  Ivan Maidanski  <ivmai@mail.ru>
+
+       * 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  <ivmai@mail.ru>
 
        * include/private/gc_priv.h (_GNU_SOURCE): Include features.h
diff --git a/misc.c b/misc.c
index 51a9248301f3ed3fcc7cb6bbb0e53431d87c77a5..59bdd127a6c1d1121d28a2d6a052fbcdeaad49b9 100644 (file)
--- 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);
           }
index 4ec6fe1fc7db28d9ab1cfe620a38afe15cd5e2fc..af0c62e5b58e0d8a9d488864ce80dba254107c8f 100644 (file)
@@ -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;