2010-03-12 Rodrigo Kumpera <rkumpera@novell.com>
[mono.git] / mono / metadata / mono-config.c
blob9145603be81e70d177f5ef6def4c2fdc2b5dc67a
1 /*
2 * mono-config.c
4 * Runtime and assembly configuration file support routines.
6 * Author: Paolo Molaro (lupus@ximian.com)
8 * Copyright 2002-2003 Ximian, Inc (http://www.ximian.com)
9 * Copyright 2004-2009 Novell, Inc (http://www.novell.com)
11 #include "config.h"
12 #include <glib.h>
13 #include <string.h>
15 #include "mono/metadata/assembly.h"
16 #include "mono/metadata/loader.h"
17 #include "mono/metadata/mono-config.h"
18 #include "mono/metadata/metadata-internals.h"
19 #include "mono/metadata/object-internals.h"
20 #include "mono/utils/mono-logger-internal.h"
22 #if defined(TARGET_PS3)
23 #define CONFIG_OS "CellOS"
24 #elif defined(__linux__)
25 #define CONFIG_OS "linux"
26 #elif defined(__APPLE__)
27 #define CONFIG_OS "osx"
28 #elif defined(sun)
29 #define CONFIG_OS "solaris"
30 #elif defined(__FreeBSD__)
31 #define CONFIG_OS "freebsd"
32 #elif defined(__NetBSD__)
33 #define CONFIG_OS "netbsd"
34 #elif defined(__OpenBSD__)
35 #define CONFIG_OS "openbsd"
36 #elif defined(__WIN32__)
37 #define CONFIG_OS "windows"
38 #elif defined(_IBMR2)
39 #define CONFIG_OS "aix"
40 #elif defined(__hpux)
41 #define CONFIG_OS "hpux"
42 #else
43 #warning Unknown operating system
44 #define CONFIG_OS "unknownOS"
45 #endif
47 #ifndef CONFIG_CPU
48 #if defined(__i386__)
49 #define CONFIG_CPU "x86"
50 #define CONFIG_WORDSIZE "32"
51 #elif defined(__x86_64__)
52 #define CONFIG_CPU "x86-64"
53 #define CONFIG_WORDSIZE "64"
54 #elif defined(sparc) || defined(__sparc__)
55 #define CONFIG_CPU "sparc"
56 #define CONFIG_WORDSIZE "32"
57 #elif defined(__ppc64__) || defined(__powerpc64__) || defined(TARGET_POWERPC)
58 #define CONFIG_WORDSIZE "64"
59 #ifdef __mono_ppc_ilp32__
60 # define CONFIG_CPU "ppc64ilp32"
61 #else
62 # define CONFIG_CPU "ppc64"
63 #endif
64 #elif defined(__ppc__) || defined(__powerpc__)
65 #define CONFIG_CPU "ppc"
66 #define CONFIG_WORDSIZE "32"
67 #elif defined(__s390x__)
68 #define CONFIG_CPU "s390x"
69 #define CONFIG_WORDSIZE "64"
70 #elif defined(__s390__)
71 #define CONFIG_CPU "s390"
72 #define CONFIG_WORDSIZE "32"
73 #elif defined(__arm__)
74 #define CONFIG_CPU "arm"
75 #define CONFIG_WORDSIZE "32"
76 #elif defined(__ia64__)
77 #define CONFIG_CPU "ia64"
78 #define CONFIG_WORDSIZE "64"
79 #elif defined(__alpha__)
80 #define CONFIG_CPU "alpha"
81 #define CONFIG_WORDSIZE "64"
82 #elif defined(hppa) || defined(__hppa__)
83 #define CONFIG_CPU "hppa"
84 #define CONFIG_WORDSIZE "32"
85 #elif defined(mips) || defined(__mips) || defined(_mips)
86 #define CONFIG_CPU "mips"
87 #define CONFIG_WORDSIZE "32"
88 #else
89 #error Unknown CPU
90 #define CONFIG_CPU "unknownCPU"
91 #endif
92 #endif
94 static void start_element (GMarkupParseContext *context,
95 const gchar *element_name,
96 const gchar **attribute_names,
97 const gchar **attribute_values,
98 gpointer user_data,
99 GError **error);
101 static void end_element (GMarkupParseContext *context,
102 const gchar *element_name,
103 gpointer user_data,
104 GError **error);
106 static void parse_text (GMarkupParseContext *context,
107 const gchar *text,
108 gsize text_len,
109 gpointer user_data,
110 GError **error);
112 static void passthrough (GMarkupParseContext *context,
113 const gchar *text,
114 gsize text_len,
115 gpointer user_data,
116 GError **error);
118 static void parse_error (GMarkupParseContext *context,
119 GError *error,
120 gpointer user_data);
122 static const GMarkupParser
123 mono_parser = {
124 start_element,
125 end_element,
126 parse_text,
127 passthrough,
128 parse_error
131 static GHashTable *config_handlers;
133 /* when this interface is stable, export it. */
134 typedef struct MonoParseHandler MonoParseHandler;
136 struct MonoParseHandler {
137 const char *element_name;
138 void*(*init) (MonoImage *assembly);
139 void (*start) (gpointer user_data, const gchar *name,
140 const gchar **attributes,
141 const gchar **values);
142 void (*text) (gpointer user_data, const char *text, gsize test_len);
143 void (*end) (gpointer user_data, const char *name);
144 void (*finish) (gpointer user_data);
147 typedef struct {
148 MonoAssemblyBindingInfo *info;
149 void (*info_parsed)(MonoAssemblyBindingInfo *info, void *user_data);
150 void *user_data;
151 } ParserUserData;
153 typedef struct {
154 MonoParseHandler *current;
155 void *user_data;
156 MonoImage *assembly;
157 int inited;
158 } ParseState;
160 static void start_element (GMarkupParseContext *context,
161 const gchar *element_name,
162 const gchar **attribute_names,
163 const gchar **attribute_values,
164 gpointer user_data,
165 GError **error)
167 ParseState *state = user_data;
168 if (!state->current) {
169 state->current = g_hash_table_lookup (config_handlers, element_name);
170 if (state->current && state->current->init)
171 state->user_data = state->current->init (state->assembly);
173 if (state->current && state->current->start)
174 state->current->start (state->user_data, element_name, attribute_names, attribute_values);
177 static void end_element (GMarkupParseContext *context,
178 const gchar *element_name,
179 gpointer user_data,
180 GError **error)
182 ParseState *state = user_data;
183 if (state->current) {
184 if (state->current->end)
185 state->current->end (state->user_data, element_name);
186 if (strcmp (state->current->element_name, element_name) == 0) {
187 if (state->current->finish)
188 state->current->finish (state->user_data);
189 state->current = NULL;
190 state->user_data = NULL;
195 static void parse_text (GMarkupParseContext *context,
196 const gchar *text,
197 gsize text_len,
198 gpointer user_data,
199 GError **error)
201 ParseState *state = user_data;
202 if (state->current && state->current->text)
203 state->current->text (state->user_data, text, text_len);
206 static void passthrough (GMarkupParseContext *context,
207 const gchar *text,
208 gsize text_len,
209 gpointer user_data,
210 GError **error)
212 /* do nothing */
215 static void parse_error (GMarkupParseContext *context,
216 GError *error,
217 gpointer user_data)
219 ParseState *state = user_data;
220 const gchar *msg;
221 const gchar *filename;
223 filename = state && state->user_data ? (gchar *) state->user_data : "<unknown>";
224 msg = error && error->message ? error->message : "";
225 g_warning ("Error parsing %s: %s", filename, msg);
228 static int
229 arch_matches (const char* arch, const char *value)
231 char **splitted, **p;
232 int found = FALSE;
233 if (value [0] == '!')
234 return !arch_matches (arch, value + 1);
235 p = splitted = g_strsplit (value, ",", 0);
236 while (*p) {
237 if (strcmp (arch, *p) == 0) {
238 found = TRUE;
239 break;
241 p++;
243 g_strfreev (splitted);
244 return found;
247 typedef struct {
248 char *dll;
249 char *target;
250 int ignore;
251 MonoImage *assembly;
252 } DllInfo;
254 static void*
255 dllmap_init (MonoImage *assembly) {
256 DllInfo *info = g_new0 (DllInfo, 1);
257 info->assembly = assembly;
258 return info;
261 static void
262 dllmap_start (gpointer user_data,
263 const gchar *element_name,
264 const gchar **attribute_names,
265 const gchar **attribute_values)
267 int i;
268 DllInfo *info = user_data;
270 if (strcmp (element_name, "dllmap") == 0) {
271 g_free (info->dll);
272 g_free (info->target);
273 info->dll = info->target = NULL;
274 info->ignore = FALSE;
275 for (i = 0; attribute_names [i]; ++i) {
276 if (strcmp (attribute_names [i], "dll") == 0)
277 info->dll = g_strdup (attribute_values [i]);
278 else if (strcmp (attribute_names [i], "target") == 0)
279 info->target = g_strdup (attribute_values [i]);
280 else if (strcmp (attribute_names [i], "os") == 0 && !arch_matches (CONFIG_OS, attribute_values [i]))
281 info->ignore = TRUE;
282 else if (strcmp (attribute_names [i], "cpu") == 0 && !arch_matches (CONFIG_CPU, attribute_values [i]))
283 info->ignore = TRUE;
284 else if (strcmp (attribute_names [i], "wordsize") == 0 && !arch_matches (CONFIG_WORDSIZE, attribute_values [i]))
285 info->ignore = TRUE;
287 if (!info->ignore)
288 mono_dllmap_insert (info->assembly, info->dll, NULL, info->target, NULL);
289 } else if (strcmp (element_name, "dllentry") == 0) {
290 const char *name = NULL, *target = NULL, *dll = NULL;
291 int ignore = FALSE;
292 for (i = 0; attribute_names [i]; ++i) {
293 if (strcmp (attribute_names [i], "dll") == 0)
294 dll = attribute_values [i];
295 else if (strcmp (attribute_names [i], "target") == 0)
296 target = attribute_values [i];
297 else if (strcmp (attribute_names [i], "name") == 0)
298 name = attribute_values [i];
299 else if (strcmp (attribute_names [i], "os") == 0 && !arch_matches (CONFIG_OS, attribute_values [i]))
300 ignore = TRUE;
301 else if (strcmp (attribute_names [i], "cpu") == 0 && !arch_matches (CONFIG_CPU, attribute_values [i]))
302 ignore = TRUE;
303 else if (strcmp (attribute_names [i], "wordsize") == 0 && !arch_matches (CONFIG_WORDSIZE, attribute_values [i]))
304 ignore = TRUE;
306 if (!dll)
307 dll = info->dll;
308 if (!info->ignore && !ignore)
309 mono_dllmap_insert (info->assembly, info->dll, name, dll, target);
313 static void
314 dllmap_finish (gpointer user_data)
316 DllInfo *info = user_data;
318 g_free (info->dll);
319 g_free (info->target);
320 g_free (info);
323 static const MonoParseHandler
324 dllmap_handler = {
325 "dllmap",
326 dllmap_init,
327 dllmap_start,
328 NULL, /* text */
329 NULL, /* end */
330 dllmap_finish
333 static void
334 legacyUEP_start (gpointer user_data,
335 const gchar *element_name,
336 const gchar **attribute_names,
337 const gchar **attribute_values) {
338 if ((strcmp (element_name, "legacyUnhandledExceptionPolicy") == 0) &&
339 (attribute_names [0] != NULL) &&
340 (strcmp (attribute_names [0], "enabled") == 0)) {
341 if ((strcmp (attribute_values [0], "1") == 0) ||
342 (g_ascii_strcasecmp (attribute_values [0], "true") == 0)) {
343 mono_runtime_unhandled_exception_policy_set (MONO_UNHANDLED_POLICY_LEGACY);
348 static const MonoParseHandler
349 legacyUEP_handler = {
350 "legacyUnhandledExceptionPolicy",
351 NULL, /* init */
352 legacyUEP_start,
353 NULL, /* text */
354 NULL, /* end */
355 NULL, /* finish */
358 static int inited = 0;
360 static void
361 mono_config_init (void)
363 inited = 1;
364 config_handlers = g_hash_table_new (g_str_hash, g_str_equal);
365 g_hash_table_insert (config_handlers, (gpointer) dllmap_handler.element_name, (gpointer) &dllmap_handler);
366 g_hash_table_insert (config_handlers, (gpointer) legacyUEP_handler.element_name, (gpointer) &legacyUEP_handler);
369 /* FIXME: error handling */
371 static void
372 mono_config_parse_xml_with_context (ParseState *state, const char *text, gsize len)
374 GMarkupParseContext *context;
376 if (!inited)
377 mono_config_init ();
379 context = g_markup_parse_context_new (&mono_parser, 0, state, NULL);
380 if (g_markup_parse_context_parse (context, text, len, NULL)) {
381 g_markup_parse_context_end_parse (context, NULL);
383 g_markup_parse_context_free (context);
386 /* If assembly is NULL, parse in the global context */
387 static int
388 mono_config_parse_file_with_context (ParseState *state, const char *filename)
390 gchar *text;
391 gsize len;
392 gint offset;
394 mono_trace (G_LOG_LEVEL_INFO, MONO_TRACE_CONFIG,
395 "Config attempting to parse: '%s'.", filename);
397 if (!g_file_get_contents (filename, &text, &len, NULL))
398 return 0;
401 offset = 0;
402 if (len > 3 && text [0] == '\xef' && text [1] == (gchar) '\xbb' && text [2] == '\xbf')
403 offset = 3; /* Skip UTF-8 BOM */
404 if (state->user_data == NULL)
405 state->user_data = (gpointer) filename;
406 mono_config_parse_xml_with_context (state, text + offset, len - offset);
407 g_free (text);
408 return 1;
412 * mono_config_parse_memory:
413 * @buffer: a pointer to an string XML representation of the configuration
415 * Parses the configuration from a buffer
417 void
418 mono_config_parse_memory (const char *buffer)
420 ParseState state = {NULL};
422 state.user_data = (gpointer) "<buffer>";
423 mono_config_parse_xml_with_context (&state, buffer, strlen (buffer));
426 static void
427 mono_config_parse_file (const char *filename)
429 ParseState state = {NULL};
430 state.user_data = (gpointer) filename;
431 mono_config_parse_file_with_context (&state, filename);
435 * use the equivalent lookup code from the GAC when available.
436 * Depending on state, this should give something like:
437 * aname/version-pubtoken/
438 * aname/version/
439 * aname
441 static char*
442 get_assembly_filename (MonoImage *image, int state)
444 switch (state) {
445 case 0:
446 return g_strdup (mono_image_get_name (image));
447 default:
448 return NULL;
452 typedef struct _BundledConfig BundledConfig;
454 struct _BundledConfig {
455 BundledConfig *next;
456 const char* aname;
457 const char* config_xml;
460 static BundledConfig *bundled_configs = NULL;
462 static const char *bundled_machine_config = NULL;
464 void
465 mono_register_config_for_assembly (const char* assembly_name, const char* config_xml)
467 BundledConfig *bconfig;
469 bconfig = g_new0 (BundledConfig, 1);
470 bconfig->aname = assembly_name;
471 bconfig->config_xml = config_xml;
472 bconfig->next = bundled_configs;
473 bundled_configs = bconfig;
476 const char *
477 mono_config_string_for_assembly_file (const char *filename)
479 BundledConfig *bconfig;
481 for (bconfig = bundled_configs; bconfig; bconfig = bconfig->next) {
482 if (bconfig->aname && strcmp (bconfig->aname, filename) == 0)
483 return bconfig->config_xml;
485 return NULL;
488 void
489 mono_config_for_assembly (MonoImage *assembly)
491 ParseState state = {NULL};
492 int got_it = 0, i;
493 char *aname, *cfg, *cfg_name;
494 const char *bundled_config;
495 const char *home;
497 state.assembly = assembly;
499 bundled_config = mono_config_string_for_assembly_file (assembly->module_name);
500 if (bundled_config) {
501 state.user_data = (gpointer) "<bundled>";
502 mono_config_parse_xml_with_context (&state, bundled_config, strlen (bundled_config));
505 cfg_name = g_strdup_printf ("%s.config", mono_image_get_filename (assembly));
506 mono_config_parse_file_with_context (&state, cfg_name);
507 g_free (cfg_name);
509 cfg_name = g_strdup_printf ("%s.config", mono_image_get_name (assembly));
511 home = g_get_home_dir ();
513 for (i = 0; (aname = get_assembly_filename (assembly, i)) != NULL; ++i) {
514 cfg = g_build_filename (mono_get_config_dir (), "mono", "assemblies", aname, cfg_name, NULL);
515 got_it += mono_config_parse_file_with_context (&state, cfg);
516 g_free (cfg);
518 #ifdef TARGET_WIN32
519 cfg = g_build_filename (home, ".mono", "assemblies", aname, cfg_name, NULL);
520 got_it += mono_config_parse_file_with_context (&state, cfg);
521 g_free (cfg);
522 #endif
523 g_free (aname);
524 if (got_it)
525 break;
527 g_free (cfg_name);
531 * mono_config_parse:
532 * @filename: the filename to load the configuration variables from.
534 * Pass a NULL filename to parse the default config files
535 * (or the file in the MONO_CONFIG env var).
537 void
538 mono_config_parse (const char *filename) {
539 const char *home;
540 char *mono_cfg;
541 #ifndef TARGET_WIN32
542 char *user_cfg;
543 #endif
545 if (filename) {
546 mono_config_parse_file (filename);
547 return;
550 home = g_getenv ("MONO_CONFIG");
551 if (home) {
552 mono_config_parse_file (home);
553 return;
556 mono_cfg = g_build_filename (mono_get_config_dir (), "mono", "config", NULL);
557 mono_config_parse_file (mono_cfg);
558 g_free (mono_cfg);
560 #ifndef TARGET_WIN32
561 home = g_get_home_dir ();
562 user_cfg = g_strconcat (home, G_DIR_SEPARATOR_S, ".mono/config", NULL);
563 mono_config_parse_file (user_cfg);
564 g_free (user_cfg);
565 #endif
568 static const char *mono_cfg_dir = NULL;
570 /* Invoked during startup */
571 void
572 mono_set_config_dir (const char *dir)
574 /* If this variable is set, overrides the directory computed */
575 mono_cfg_dir = g_getenv ("MONO_CFG_DIR");
576 if (mono_cfg_dir == NULL)
577 mono_cfg_dir = g_strdup (dir);
580 const char*
581 mono_get_config_dir (void)
583 if (mono_cfg_dir == NULL)
584 mono_set_dirs (NULL, NULL);
586 return mono_cfg_dir;
589 void
590 mono_register_machine_config (const char *config_xml)
592 bundled_machine_config = config_xml;
595 const char *
596 mono_get_machine_config (void)
598 return bundled_machine_config;
601 static void
602 assembly_binding_end (gpointer user_data, const char *element_name)
604 ParserUserData *pud = user_data;
606 if (!strcmp (element_name, "dependentAssembly")) {
607 if (pud->info_parsed && pud->info) {
608 pud->info_parsed (pud->info, pud->user_data);
609 g_free (pud->info->name);
610 g_free (pud->info->culture);
615 static void
616 publisher_policy_start (gpointer user_data,
617 const gchar *element_name,
618 const gchar **attribute_names,
619 const gchar **attribute_values)
621 ParserUserData *pud;
622 MonoAssemblyBindingInfo *info;
623 int n;
625 pud = user_data;
626 info = pud->info;
627 if (!strcmp (element_name, "dependentAssembly")) {
628 info->name = NULL;
629 info->culture = NULL;
630 info->has_old_version_bottom = FALSE;
631 info->has_old_version_top = FALSE;
632 info->has_new_version = FALSE;
633 info->is_valid = FALSE;
634 memset (&info->old_version_bottom, 0, sizeof (info->old_version_bottom));
635 memset (&info->old_version_top, 0, sizeof (info->old_version_top));
636 memset (&info->new_version, 0, sizeof (info->new_version));
637 } if (!strcmp (element_name, "assemblyIdentity")) {
638 for (n = 0; attribute_names [n]; n++) {
639 const gchar *attribute_name = attribute_names [n];
641 if (!strcmp (attribute_name, "name"))
642 info->name = g_strdup (attribute_values [n]);
643 else if (!strcmp (attribute_name, "publicKeyToken")) {
644 if (strlen (attribute_values [n]) == MONO_PUBLIC_KEY_TOKEN_LENGTH - 1)
645 g_strlcpy ((char *) info->public_key_token, attribute_values [n], MONO_PUBLIC_KEY_TOKEN_LENGTH);
646 } else if (!strcmp (attribute_name, "culture")) {
647 if (!strcmp (attribute_values [n], "neutral"))
648 info->culture = g_strdup ("");
649 else
650 info->culture = g_strdup (attribute_values [n]);
653 } else if (!strcmp (element_name, "bindingRedirect")) {
654 for (n = 0; attribute_names [n]; n++) {
655 const gchar *attribute_name = attribute_names [n];
657 if (!strcmp (attribute_name, "oldVersion")) {
658 gchar **numbers, **version, **versions;
659 gint major, minor, build, revision;
661 /* Invalid value */
662 if (!strcmp (attribute_values [n], ""))
663 return;
665 versions = g_strsplit (attribute_values [n], "-", 2);
666 version = g_strsplit (*versions, ".", 4);
668 /* We assign the values to gint vars to do the checks */
669 numbers = version;
670 major = *numbers ? atoi (*numbers++) : -1;
671 minor = *numbers ? atoi (*numbers++) : -1;
672 build = *numbers ? atoi (*numbers++) : -1;
673 revision = *numbers ? atoi (*numbers) : -1;
674 g_strfreev (version);
675 if (major < 0 || minor < 0 || build < 0 || revision < 0) {
676 g_strfreev (versions);
677 return;
680 info->old_version_bottom.major = major;
681 info->old_version_bottom.minor = minor;
682 info->old_version_bottom.build = build;
683 info->old_version_bottom.revision = revision;
684 info->has_old_version_bottom = TRUE;
686 if (!*(versions + 1)) {
687 g_strfreev (versions);
688 continue;
691 numbers = version = g_strsplit (*(versions + 1), ".", 4);
692 major = *numbers ? atoi (*numbers++) : -1;
693 minor = *numbers ? atoi (*numbers++) : -1;
694 build = *numbers ? atoi (*numbers++) : -1;
695 revision = *numbers ? atoi (*numbers) : 1;
696 g_strfreev (version);
697 if (major < 0 || minor < 0 || build < 0 || revision < 0) {
698 g_strfreev (versions);
699 return;
702 info->old_version_top.major = major;
703 info->old_version_top.minor = minor;
704 info->old_version_top.build = build;
705 info->old_version_top.revision = revision;
706 info->has_old_version_top = TRUE;
708 g_strfreev (versions);
709 } else if (!strcmp (attribute_name, "newVersion")) {
710 gchar **numbers, **version;
712 /* Invalid value */
713 if (!strcmp (attribute_values [n], ""))
714 return;
716 numbers = version = g_strsplit (attribute_values [n], ".", 4);
717 info->new_version.major = *numbers ? atoi (*numbers++) : -1;
718 info->new_version.minor = *numbers ? atoi (*numbers++) : -1;
719 info->new_version.build = *numbers ? atoi (*numbers++) : -1;
720 info->new_version.revision = *numbers ? atoi (*numbers) : -1;
721 info->has_new_version = TRUE;
722 g_strfreev (version);
728 static MonoParseHandler
729 publisher_policy_parser = {
730 "", /* We don't need to use declare an xml element */
731 NULL,
732 publisher_policy_start,
733 NULL,
734 NULL,
735 NULL
738 void
739 mono_config_parse_publisher_policy (const gchar *filename, MonoAssemblyBindingInfo *info)
741 ParserUserData user_data = {
742 info,
743 NULL,
744 NULL
746 ParseState state = {
747 &publisher_policy_parser, /* MonoParseHandler */
748 &user_data, /* user_data */
749 NULL, /* MonoImage (we don't need it right now)*/
750 TRUE /* We are already inited */
753 mono_config_parse_file_with_context (&state, filename);
756 static MonoParseHandler
757 config_assemblybinding_parser = {
758 "", /* We don't need to use declare an xml element */
759 NULL,
760 publisher_policy_start,
761 NULL,
762 assembly_binding_end,
763 NULL
766 void
767 mono_config_parse_assembly_bindings (const char *filename, int amajor, int aminor, void *user_data, void (*infocb)(MonoAssemblyBindingInfo *info, void *user_data))
769 MonoAssemblyBindingInfo info;
770 ParserUserData pud;
771 ParseState state;
773 info.major = amajor;
774 info.minor = aminor;
776 pud.info = &info;
777 pud.info_parsed = infocb;
778 pud.user_data = user_data;
780 state.current = &config_assemblybinding_parser; /* MonoParseHandler */
781 state.user_data = &pud;
782 state.assembly = NULL; /* MonoImage (we don't need it right now)*/
783 state.inited = TRUE; /* We are already inited */
785 mono_config_parse_file_with_context (&state, filename);