X-Git-Url: http://wien.tomnetworks.com/gitweb/?a=blobdiff_plain;f=mono%2Fmetadata%2Fmono-config.c;h=c3840963bd92b69c156c1cc999630e3fa97c2402;hb=HEAD;hp=8b4c0c9ff829df19f4d7df2c48c6dddd2bcb8235;hpb=17fb976edfe49c8e9a7a7a9c899b3db4868aebe8;p=mono.git diff --git a/mono/metadata/mono-config.c b/mono/metadata/mono-config.c index 8b4c0c9ff82..c3840963bd9 100644 --- a/mono/metadata/mono-config.c +++ b/mono/metadata/mono-config.c @@ -42,6 +42,8 @@ #define CONFIG_OS "hpux" #elif defined(__HAIKU__) #define CONFIG_OS "haiku" +#elif defined (TARGET_WASM) +#define CONFIG_OS "wasm" #else #warning Unknown operating system #define CONFIG_OS "unknownOS" @@ -79,12 +81,12 @@ #elif defined(__aarch64__) #define CONFIG_CPU "armv8" #define CONFIG_WORDSIZE "64" -#elif defined(__ia64__) -#define CONFIG_CPU "ia64" -#define CONFIG_WORDSIZE "64" #elif defined(mips) || defined(__mips) || defined(_mips) #define CONFIG_CPU "mips" #define CONFIG_WORDSIZE "32" +#elif defined(TARGET_WASM) +#define CONFIG_CPU "wasm" +#define CONFIG_WORDSIZE "32" #else #error Unknown CPU #define CONFIG_CPU "unknownCPU" @@ -163,8 +165,7 @@ mono_parser = { static GHashTable *config_handlers; -static const char *mono_cfg_dir = NULL; -static char *mono_cfg_dir_allocated = NULL; +static char *mono_cfg_dir = NULL; /* when this interface is stable, export it. */ typedef struct MonoParseHandler MonoParseHandler; @@ -465,12 +466,15 @@ mono_config_init (void) g_hash_table_insert (config_handlers, (gpointer) aot_cache_handler.element_name, (gpointer) &aot_cache_handler); } +/** + * mono_config_cleanup: + */ void mono_config_cleanup (void) { if (config_handlers) g_hash_table_destroy (config_handlers); - g_free (mono_cfg_dir_allocated); + g_free (mono_cfg_dir); } /* FIXME: error handling */ @@ -581,6 +585,9 @@ mono_register_config_for_assembly (const char* assembly_name, const char* config bundled_configs = bconfig; } +/** + * mono_config_string_for_assembly_file: + */ const char * mono_config_string_for_assembly_file (const char *filename) { @@ -593,6 +600,9 @@ mono_config_string_for_assembly_file (const char *filename) return NULL; } +/** + * mono_config_for_assembly: + */ void mono_config_for_assembly (MonoImage *assembly) { @@ -652,9 +662,10 @@ mono_config_parse (const char *filename) { return; } - home = g_getenv ("MONO_CONFIG"); - if (home) { - mono_config_parse_file (home); + // FIXME: leak, do we store any references to home + char *env_home = g_getenv ("MONO_CONFIG"); + if (env_home) { + mono_config_parse_file (env_home); return; } @@ -662,7 +673,7 @@ mono_config_parse (const char *filename) { mono_config_parse_file (mono_cfg); g_free (mono_cfg); -#if !defined(TARGET_WIN32) && !defined(__native_client__) +#if !defined(TARGET_WIN32) home = g_get_home_dir (); user_cfg = g_strconcat (home, G_DIR_SEPARATOR_S, ".mono/config", NULL); mono_config_parse_file (user_cfg); @@ -670,16 +681,24 @@ mono_config_parse (const char *filename) { #endif } -/* Invoked during startup */ +/** + * mono_set_config_dir: + * Invoked during startup + */ void mono_set_config_dir (const char *dir) { - /* If this variable is set, overrides the directory computed */ - mono_cfg_dir = g_getenv ("MONO_CFG_DIR"); - if (mono_cfg_dir == NULL) - mono_cfg_dir = mono_cfg_dir_allocated = g_strdup (dir); + /* If this environment variable is set, overrides the directory computed */ + char *env_mono_cfg_dir = g_getenv ("MONO_CFG_DIR"); + if (env_mono_cfg_dir == NULL && dir != NULL) + env_mono_cfg_dir = g_strdup (dir); + + mono_cfg_dir = env_mono_cfg_dir; } +/** + * mono_get_config_dir: + */ const char* mono_get_config_dir (void) { @@ -689,12 +708,18 @@ mono_get_config_dir (void) return mono_cfg_dir; } +/** + * mono_register_machine_config: + */ void mono_register_machine_config (const char *config_xml) { bundled_machine_config = config_xml; } +/** + * mono_get_machine_config: + */ const char * mono_get_machine_config (void) { @@ -890,12 +915,18 @@ mono_config_parse_assembly_bindings (const char *filename, int amajor, int amino static mono_bool mono_server_mode = FALSE; +/** + * mono_config_set_server_mode: + */ void mono_config_set_server_mode (mono_bool server_mode) { mono_server_mode = server_mode; } +/** + * mono_config_is_server_mode: + */ mono_bool mono_config_is_server_mode (void) {