Don't fsync() on a pipe (causes bug #35936)
[mono.git] / support / signal.c
index 8f16106f59f47b55a88d86d4a43510462c007154..a018bc67928443744109fb0427ec516df7e66d4d 100644 (file)
 #ifndef HOST_WIN32
 #include <sys/time.h>
 #include <sys/types.h>
-#if defined(__APPLE__)
-#include "fakepoll.h"
-#else
+#if defined(HAVE_POLL_H)
 #include <poll.h>
+#elif defined(HAVE_SYS_POLL_H)
+#include <sys/poll.h>
 #endif
 #include <unistd.h>
 #include <stdlib.h>
@@ -184,7 +184,6 @@ default_handler (int signum)
                        for (j = 0; j < pipecounter; ++j) {
                                int r;
                                do { r = write (fd, &c, 1); } while (keep_trying (r));
-                               fsync (fd); /* force */
                        }
                }
        }
@@ -195,6 +194,7 @@ static pthread_mutex_t signals_mutex = PTHREAD_MUTEX_INITIALIZER;
 void*
 Mono_Unix_UnixSignal_install (int sig)
 {
+#if defined(HAVE_SIGNAL)
        int i;
        signal_info* h = NULL; 
        int have_handler = 0;
@@ -252,6 +252,10 @@ Mono_Unix_UnixSignal_install (int sig)
        release_mutex (&signals_mutex);
 
        return h;
+#else
+       g_error ("signal() is not supported by this platform");
+       return 0;
+#endif
 }
 
 static int
@@ -269,6 +273,7 @@ count_handlers (int signum)
 int
 Mono_Unix_UnixSignal_uninstall (void* info)
 {
+#if defined(HAVE_SIGNAL)       
        signal_info* h;
        int r = -1;
 
@@ -294,6 +299,10 @@ Mono_Unix_UnixSignal_uninstall (void* info)
        release_mutex (&signals_mutex);
 
        return r;
+#else
+       g_error ("signal() is not supported by this platform");
+       return 0;
+#endif
 }
 
 static int