2007-01-30 Zoltan Varga <vargaz@gmail.com>
[mono.git] / mono / metadata / filewatcher.c
index 6952df40f216a96e863e58fecf1d19537c568ed7..954b1111e435b91dc2388d238922f5da27926139 100644 (file)
@@ -15,6 +15,7 @@
 #include <mono/metadata/exception.h>
 #include <mono/metadata/filewatcher.h>
 #include <mono/metadata/marshal.h>
+#include <mono/utils/mono-dl.h>
 #if (defined (PLATFORM_WIN32) && WINVER >= 0x0400)
 
 /*
@@ -27,63 +28,6 @@ ves_icall_System_IO_FSW_SupportsFSW (void)
        return 1;
 }
 
-gpointer
-ves_icall_System_IO_FSW_OpenDirectory (MonoString *path, gpointer reserved)
-{
-       return NULL;
-       /*
-       gpointer dir;
-       gchar *utf8path;
-
-       MONO_ARCH_SAVE_REGS;
-
-       dir = CreateFile (path, GENERIC_READ, FILE_SHARE_READ | FILE_SHARE_DELETE,
-                         NULL, OPEN_EXISTING, FILE_FLAG_BACKUP_SEMANTICS, NULL);
-
-       return dir;
-       */
-}
-
-gboolean
-ves_icall_System_IO_FSW_CloseDirectory (gpointer handle)
-{
-       return FALSE;
-       /*
-       MONO_ARCH_SAVE_REGS;
-
-       return CloseHandle (handle);
-       */
-}
-
-gboolean
-ves_icall_System_IO_FSW_ReadDirectoryChanges (gpointer handle,
-                                             MonoArray *buffer,
-                                             gboolean includeSubdirs,
-                                             gint filters,
-                                             gpointer overlap,
-                                             gpointer callback)
-{
-       return FALSE;
-       /*
-       gpointer dest;
-       gint size;
-       MonoObject *delegate = (MonoObject *) callback;
-       MonoMethod *im;
-       LPOVERLAPPED_COMPLETION_ROUTINE func;
-
-       MONO_ARCH_SAVE_REGS;
-
-       size = mono_array_length (buffer);
-       dest = mono_array_addr_with_size (buffer, 1, 0);
-
-       im = mono_get_delegate_invoke (mono_object_get_class (delegate));
-       func = mono_compile_method (im);
-       return FALSE;
-       * return ReadDirectoryChanges (handle, dest, size, includeSubdirs, filters,
-                                    NULL, (LPOVERLAPPED) overlap,
-                                    func); */
-}
-
 gboolean
 ves_icall_System_IO_FAMW_InternalFAMNextEvent (gpointer conn,
                                               MonoString **filename,
@@ -103,10 +47,12 @@ ves_icall_System_IO_FSW_SupportsFSW (void)
 #if HAVE_KQUEUE
        return 3;
 #else
-       GModule *fam_module;
+       MonoDl *fam_module;
        gchar *filename;
        int lib_used = 4; /* gamin */
        int inotify_instance;
+       void *iter;
+       char *err;
 
        MONO_ARCH_SAVE_REGS;
 
@@ -116,20 +62,24 @@ ves_icall_System_IO_FSW_SupportsFSW (void)
                return 5; /* inotify */
        }
 
-       filename = g_module_build_path (NULL, "libgamin-1.so.0");
-       fam_module = g_module_open (filename, G_MODULE_BIND_LAZY);
+       iter = NULL;
+       /* the build_path calls here should be avoided, since we provide the full name */
+       filename = mono_dl_build_path (NULL, "libgamin-1.so.0", &iter);
+       fam_module = mono_dl_open (filename, MONO_DL_LAZY, NULL);
        g_free (filename);
        if (fam_module == NULL) {
                lib_used = 2; /* FAM */
-               filename = g_module_build_path (NULL, "libfam.so.0");
-               fam_module = g_module_open (filename, G_MODULE_BIND_LAZY);
+               iter = NULL;
+               filename = mono_dl_build_path (NULL, "libfam.so.0", &iter);
+               fam_module = mono_dl_open (filename, MONO_DL_LAZY, NULL);
                g_free (filename);
        }
 
        if (fam_module == NULL)
                return 0;
 
-       g_module_symbol (fam_module, "FAMNextEvent", (gpointer *) &FAMNextEvent);
+       err = mono_dl_symbol (fam_module, "FAMNextEvent", (gpointer *) &FAMNextEvent);
+       g_free (err);
        if (FAMNextEvent == NULL)
                return 0;
 
@@ -137,29 +87,6 @@ ves_icall_System_IO_FSW_SupportsFSW (void)
 #endif
 }
 
-gpointer
-ves_icall_System_IO_FSW_OpenDirectory (MonoString *path, gpointer reserved)
-{
-       return NULL;
-}
-
-gboolean
-ves_icall_System_IO_FSW_CloseDirectory (gpointer handle)
-{
-       return FALSE;
-}
-
-gboolean
-ves_icall_System_IO_FSW_ReadDirectoryChanges (gpointer handle,
-                                             MonoArray *buffer,
-                                             gboolean includeSubdirs,
-                                             gint filters,
-                                             gpointer overlap,
-                                             gpointer callback)
-{
-       return FALSE;
-}
-
 /* Almost copied from fam.h. Weird, I know */
 typedef struct {
        gint reqnum;