void mono_locks_tracer_init (void) { Dl_info info; int res; char *name; mono_os_mutex_init_recursive (&tracer_lock); if (!g_hasenv ("MONO_ENABLE_LOCK_TRACER")) return; name = g_strdup_printf ("locks.%d", getpid ()); trace_file = fopen (name, "w+"); g_free (name); #ifdef TARGET_OSX res = dladdr ((void*)&mono_locks_tracer_init, &info); /* The 0x1000 offset was found by empirically trying it. */ if (res) base_address = (size_t)info.dli_fbase - 0x1000; #endif }
gboolean mono_rand_open (void) { static gint32 status = 0; if (status != 0 || InterlockedCompareExchange (&status, 1, 0) != 0) { while (status != 2) mono_thread_info_yield (); return TRUE; } #ifdef NAME_DEV_URANDOM file = open (NAME_DEV_URANDOM, O_RDONLY); #endif #ifdef NAME_DEV_RANDOM if (file < 0) file = open (NAME_DEV_RANDOM, O_RDONLY); #endif if (file < 0) use_egd = g_hasenv ("MONO_EGD_SOCKET"); status = 2; return TRUE; }