2008-07-28 Marek Habersack <mhabersack@novell.com>
[mono.git] / mono / metadata / rawbuffer.c
index b390f76aa86ee7825f71af20530abcdcbf15b4c5..167d9b8391d9480767114e007cb819af3cf03467 100644 (file)
@@ -11,7 +11,9 @@
 #define USE_WIN32_API          1
 #endif
 
+#ifdef HAVE_UNISTD_H
 #include <unistd.h>
+#endif
 #include <errno.h>
 #ifdef USE_WIN32_API
 #include <winsock2.h>
@@ -89,6 +91,14 @@ mono_raw_buffer_init (void)
        mmap_map = g_hash_table_new (NULL, NULL);
 }
 
+void
+mono_raw_buffer_cleanup (void)
+{
+       g_hash_table_destroy (mmap_map);
+
+       DeleteCriticalSection (&mmap_mutex);
+}
+
 static void *
 mono_raw_buffer_load_mmap (int fd, int is_writable, guint32 base, size_t size)
 {
@@ -159,9 +169,7 @@ mono_raw_buffer_load_mmap (int fd, int is_writable, guint32 base, size_t size)
         * http://bugzilla.ximian.com/show_bug.cgi?id=49499
         * for more info.
         */
-       if (mprotect (ptr, end - start, prot | PROT_EXEC) != 0)
-               g_warning (G_GNUC_PRETTY_FUNCTION
-                                  ": mprotect failed: %s", g_strerror (errno));
+       mprotect (ptr, end - start, prot | PROT_EXEC);
 
        if (make_unreadable) {
                int res = mprotect (ptr, end - start, 0);