Revert "[runtime] Move the kevent() calls from KeventWatcher to the runtime, add...
authorZoltan Varga <vargaz@gmail.com>
Mon, 10 Aug 2015 19:51:39 +0000 (15:51 -0400)
committerZoltan Varga <vargaz@gmail.com>
Mon, 10 Aug 2015 19:51:39 +0000 (15:51 -0400)
This reverts commit 7f4428165809bed674697d482f76c7e9446bae4e.

Revert this as icalls don't marshal kevent structures correctly.

mcs/class/System/System.IO/KeventWatcher.cs
mono/metadata/filewatcher.c
mono/metadata/filewatcher.h
mono/metadata/icall-def.h

index 3e70b5201e7c78794d233c73cb57ed90340d60dc..27f61b35d0ea775478f504f0b288e67620fa7559 100644 (file)
@@ -355,7 +355,7 @@ namespace System.IO {
                        while (!requestStop) {
                                var changes = CreateChangeList (ref newFds);
 
-                               int numEvents = kevent_notimeout (ref conn, changes, changes.Length, eventBuffer, eventBuffer.Length);
+                               int numEvents = kevent_notimeout (conn, changes, changes.Length, eventBuffer, eventBuffer.Length, IntPtr.Zero);
 
                                if (numEvents == -1) {
                                        // Stop () signals us to stop by closing the connection
@@ -660,9 +660,6 @@ namespace System.IO {
 
                [DllImport ("libc", EntryPoint="kevent")]
                extern static int kevent_notimeout (int kq, [In]kevent[] ev, int nchanges, [Out]kevent[] evtlist, int nevents, IntPtr ptr);
-
-               [MethodImplAttribute(MethodImplOptions.InternalCall)]
-               extern static int kevent_notimeout (ref int kq, [In]kevent[] ev, int nchanges, [Out]kevent[] evtlist, int nevents);
        }
 
        class KeventWatcher : IFileWatcher
index a3dcad7dc0a4fa7603e210653ed29e85967d6cd9..664b28a05275b7bf3e68ec29e248736ca4c8ba37 100644 (file)
 #include <config.h>
 #endif
 
-#ifdef HAVE_SYS_TYPES_H
-#include <sys/types.h>
-#endif
-#ifdef HAVE_SYS_EVENT_H
-#include <sys/event.h>
-#endif
-#ifdef HAVE_SYS_TIME_H
-#include <sys/time.h>
-#endif
-
 #include <mono/metadata/appdomain.h>
 #include <mono/metadata/exception.h>
 #include <mono/metadata/filewatcher.h>
@@ -198,54 +188,3 @@ ves_icall_System_IO_InotifyWatcher_RemoveWatch (int fd, gint32 watch_descriptor)
        return inotify_rm_watch (fd, watch_descriptor);
 }
 #endif
-
-#if HAVE_KQUEUE
-
-static void
-interrupt_kevent (gpointer data)
-{
-       int *kq_ptr = data;
-
-       /* Interrupt the kevent () call by closing the fd */
-       close (*kq_ptr);
-       /* Signal to managed code that the fd is closed */
-       *kq_ptr = -1;
-}
-
-/*
- * ves_icall_System_IO_KqueueMonitor_kevent_notimeout:
- *
- *   Call kevent (), while handling runtime interruptions.
- */
-int
-ves_icall_System_IO_KqueueMonitor_kevent_notimeout (int *kq_ptr, gpointer changelist, int nchanges, gpointer eventlist, int nevents)
-{
-       int res;
-       gboolean interrupted;
-
-       mono_thread_info_install_interrupt (interrupt_kevent, kq_ptr, &interrupted);
-       if (interrupted) {
-               close (*kq_ptr);
-               *kq_ptr = -1;
-               return -1;
-       }
-
-       MONO_PREPARE_BLOCKING;
-       res = kevent (*kq_ptr, changelist, nchanges, eventlist, nevents, NULL);
-       MONO_FINISH_BLOCKING;
-
-       mono_thread_info_uninstall_interrupt (&interrupted);
-
-       return res;
-}
-
-#else
-
-int
-ves_icall_System_IO_KqueueMonitor_kevent_notimeout (int *kq_ptr, gpointer changelist, int nchanges, gpointer eventlist, int nevents)
-{
-       g_assert_not_reached ();
-       return -1;
-}
-
-#endif /* #if HAVE_KQUEUE */
index 605fd0e9ac2503d70c8eb2051e4bf7043adf4846..c57be128325b0e1f203cdaf325177806779463d3 100644 (file)
@@ -32,8 +32,6 @@ int ves_icall_System_IO_InotifyWatcher_GetInotifyInstance (void);
 int ves_icall_System_IO_InotifyWatcher_AddWatch (int fd, MonoString *directory, gint32 mask);
 int ves_icall_System_IO_InotifyWatcher_RemoveWatch (int fd, gint32 watch_descriptor);
 
-int ves_icall_System_IO_KqueueMonitor_kevent_notimeout (int *kq, gpointer changelist, int nchanges, gpointer eventlist, int nevents);
-
 G_END_DECLS
 
 #endif
index 9a5690044ba2485a8d67ecffef336117d18976c4..787e5d84b3687a3175387a9ce490486acf168310 100644 (file)
@@ -306,9 +306,6 @@ ICALL(INOW_1, "AddWatch", ves_icall_System_IO_InotifyWatcher_AddWatch)
 ICALL(INOW_2, "GetInotifyInstance", ves_icall_System_IO_InotifyWatcher_GetInotifyInstance)
 ICALL(INOW_3, "RemoveWatch", ves_icall_System_IO_InotifyWatcher_RemoveWatch)
 
-ICALL_TYPE(KQUEM, "System.IO.KqueueMonitor", KQUEM_1)
-ICALL(KQUEM_1, "kevent_notimeout", ves_icall_System_IO_KqueueMonitor_kevent_notimeout)
-
 ICALL_TYPE(MMAPIMPL, "System.IO.MemoryMappedFiles.MemoryMapImpl", MMAPIMPL_1)
 ICALL(MMAPIMPL_1, "CloseMapping", mono_mmap_close)
 ICALL(MMAPIMPL_2, "ConfigureHandleInheritability", mono_mmap_configure_inheritability)