瀏覽代碼

added raw block size as environmental variable option

Ioannis Koutras 12 年之前
父節點
當前提交
3e49b632b5
共有 1 個文件被更改,包括 11 次插入0 次删除
  1. 11 0
      src/parse_env.c

+ 11 - 0
src/parse_env.c

@@ -22,6 +22,7 @@
  * @brief  Parse the DMMLIB_OPTS enviroment variable.
  */
 
+#include <inttypes.h>
 #include <stdlib.h>
 #include <string.h>
 #include <stdio.h>
@@ -66,6 +67,16 @@ void parse_env(void) {
     }
 #endif /* WITH_DEBUG */
 
+    env = getenv("DMMLIB_SYSALLOC_SZ");
+
+    if(env != NULL) {
+        char *end;
+        uintmax_t num = strtoumax(env, &end, 10);
+        if(num != UINTMAX_MAX) {
+            systemallocator.dmm_knobs.sys_alloc_size = (double) num;
+        }
+    }
+
     systemallocator.initialized = true;
 
     return;