[serial,signal] Add support for Linux arbitrary baud rates + drop Apple legacy poll...
[mono.git] / support / signal.c
index 6acb78977e6ce84e68b90fc5823bff2207339620..28146c02611a82acbc253cd4b87f8aaa4ca8db4a 100644 (file)
 #ifndef HOST_WIN32
 #include <sys/time.h>
 #include <sys/types.h>
+#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>
 #include <string.h>
 #include <pthread.h>
-#include <mono/io-layer/atomic.h>
+#include <mono/utils/atomic.h>
 #include <mono/metadata/appdomain.h>
 #endif
 
@@ -32,7 +36,9 @@ G_BEGIN_DECLS
 typedef void (*mph_sighandler_t)(int);
 typedef struct Mono_Unix_UnixSignal_SignalInfo signal_info;
 
+#ifndef HOST_WIN32
 static int count_handlers (int signum);
+#endif
 
 void*
 Mono_Posix_Stdlib_SIG_DFL (void)
@@ -101,7 +107,7 @@ int Mono_Posix_FromRealTimeSignum (int offset, int *r)
 
 #ifndef HOST_WIN32
 
-#ifdef WAPI_ATOMIC_ASM
+#ifndef WAPI_NO_ATOMIC_ASM
        #define mph_int_get(p)     InterlockedExchangeAdd ((p), 0)
        #define mph_int_inc(p)     InterlockedIncrement ((p))
        #define mph_int_dec_test(p)     (InterlockedDecrement ((p)) == 0)
@@ -120,6 +126,7 @@ int Mono_Posix_FromRealTimeSignum (int offset, int *r)
        #define mph_int_set(p,o,n) do { *(p) = n; } while (0)
 #endif
 
+#if HAVE_PSIGNAL
 int
 Mono_Posix_Syscall_psignal (int sig, const char* s)
 {
@@ -127,6 +134,7 @@ Mono_Posix_Syscall_psignal (int sig, const char* s)
        psignal (sig, s);
        return errno == 0 ? 0 : -1;
 }
+#endif  /* def HAVE_PSIGNAL */
 
 #define NUM_SIGNALS 64
 static signal_info signals[NUM_SIGNALS];