… | |
… | |
59 | # endif |
59 | # endif |
60 | # ifndef EV_USE_MONOTONIC |
60 | # ifndef EV_USE_MONOTONIC |
61 | # define EV_USE_MONOTONIC 1 |
61 | # define EV_USE_MONOTONIC 1 |
62 | # endif |
62 | # endif |
63 | # endif |
63 | # endif |
64 | # elif !defined(EV_USE_CLOCK_SYSCALL) |
64 | # elif !defined EV_USE_CLOCK_SYSCALL |
65 | # define EV_USE_CLOCK_SYSCALL 0 |
65 | # define EV_USE_CLOCK_SYSCALL 0 |
66 | # endif |
66 | # endif |
67 | |
67 | |
68 | # if HAVE_CLOCK_GETTIME |
68 | # if HAVE_CLOCK_GETTIME |
69 | # ifndef EV_USE_MONOTONIC |
69 | # ifndef EV_USE_MONOTONIC |
… | |
… | |
219 | #define _DARWIN_UNLIMITED_SELECT 1 |
219 | #define _DARWIN_UNLIMITED_SELECT 1 |
220 | |
220 | |
221 | /* this block tries to deduce configuration from header-defined symbols and defaults */ |
221 | /* this block tries to deduce configuration from header-defined symbols and defaults */ |
222 | |
222 | |
223 | /* try to deduce the maximum number of signals on this platform */ |
223 | /* try to deduce the maximum number of signals on this platform */ |
224 | #if defined (EV_NSIG) |
224 | #if defined EV_NSIG |
225 | /* use what's provided */ |
225 | /* use what's provided */ |
226 | #elif defined (NSIG) |
226 | #elif defined NSIG |
227 | # define EV_NSIG (NSIG) |
227 | # define EV_NSIG (NSIG) |
228 | #elif defined(_NSIG) |
228 | #elif defined _NSIG |
229 | # define EV_NSIG (_NSIG) |
229 | # define EV_NSIG (_NSIG) |
230 | #elif defined (SIGMAX) |
230 | #elif defined SIGMAX |
231 | # define EV_NSIG (SIGMAX+1) |
231 | # define EV_NSIG (SIGMAX+1) |
232 | #elif defined (SIG_MAX) |
232 | #elif defined SIG_MAX |
233 | # define EV_NSIG (SIG_MAX+1) |
233 | # define EV_NSIG (SIG_MAX+1) |
234 | #elif defined (_SIG_MAX) |
234 | #elif defined _SIG_MAX |
235 | # define EV_NSIG (_SIG_MAX+1) |
235 | # define EV_NSIG (_SIG_MAX+1) |
236 | #elif defined (MAXSIG) |
236 | #elif defined MAXSIG |
237 | # define EV_NSIG (MAXSIG+1) |
237 | # define EV_NSIG (MAXSIG+1) |
238 | #elif defined (MAX_SIG) |
238 | #elif defined MAX_SIG |
239 | # define EV_NSIG (MAX_SIG+1) |
239 | # define EV_NSIG (MAX_SIG+1) |
240 | #elif defined (SIGARRAYSIZE) |
240 | #elif defined SIGARRAYSIZE |
241 | # define EV_NSIG (SIGARRAYSIZE) /* Assume ary[SIGARRAYSIZE] */ |
241 | # define EV_NSIG (SIGARRAYSIZE) /* Assume ary[SIGARRAYSIZE] */ |
242 | #elif defined (_sys_nsig) |
242 | #elif defined _sys_nsig |
243 | # define EV_NSIG (_sys_nsig) /* Solaris 2.5 */ |
243 | # define EV_NSIG (_sys_nsig) /* Solaris 2.5 */ |
244 | #else |
244 | #else |
245 | # error "unable to find value for NSIG, please report" |
245 | # error "unable to find value for NSIG, please report" |
246 | /* to make it compile regardless, just remove the above line, */ |
246 | /* to make it compile regardless, just remove the above line, */ |
247 | /* but consider reporting it, too! :) */ |
247 | /* but consider reporting it, too! :) */ |
… | |
… | |
259 | # define EV_USE_CLOCK_SYSCALL 0 |
259 | # define EV_USE_CLOCK_SYSCALL 0 |
260 | # endif |
260 | # endif |
261 | #endif |
261 | #endif |
262 | |
262 | |
263 | #ifndef EV_USE_MONOTONIC |
263 | #ifndef EV_USE_MONOTONIC |
264 | # if defined (_POSIX_MONOTONIC_CLOCK) && _POSIX_MONOTONIC_CLOCK >= 0 |
264 | # if defined _POSIX_MONOTONIC_CLOCK && _POSIX_MONOTONIC_CLOCK >= 0 |
265 | # define EV_USE_MONOTONIC EV_FEATURE_OS |
265 | # define EV_USE_MONOTONIC EV_FEATURE_OS |
266 | # else |
266 | # else |
267 | # define EV_USE_MONOTONIC 0 |
267 | # define EV_USE_MONOTONIC 0 |
268 | # endif |
268 | # endif |
269 | #endif |
269 | #endif |
… | |
… | |
395 | # define EV_USE_INOTIFY 0 |
395 | # define EV_USE_INOTIFY 0 |
396 | #endif |
396 | #endif |
397 | |
397 | |
398 | #if !EV_USE_NANOSLEEP |
398 | #if !EV_USE_NANOSLEEP |
399 | /* hp-ux has it in sys/time.h, which we unconditionally include above */ |
399 | /* hp-ux has it in sys/time.h, which we unconditionally include above */ |
400 | # if !defined(_WIN32) && !defined(__hpux) |
400 | # if !defined _WIN32 && !defined __hpux |
401 | # include <sys/select.h> |
401 | # include <sys/select.h> |
402 | # endif |
402 | # endif |
403 | #endif |
403 | #endif |
404 | |
404 | |
405 | #if EV_USE_INOTIFY |
405 | #if EV_USE_INOTIFY |
… | |
… | |
567 | #define ECB_MEMORY_FENCE_RELEASE __asm__ __volatile__ ("sfence") /* play safe - not needed in any current cpu */ |
567 | #define ECB_MEMORY_FENCE_RELEASE __asm__ __volatile__ ("sfence") /* play safe - not needed in any current cpu */ |
568 | #elif __powerpc__ || __ppc__ || __powerpc64__ || __ppc64__ |
568 | #elif __powerpc__ || __ppc__ || __powerpc64__ || __ppc64__ |
569 | #define ECB_MEMORY_FENCE __asm__ __volatile__ ("sync" : : : "memory") |
569 | #define ECB_MEMORY_FENCE __asm__ __volatile__ ("sync" : : : "memory") |
570 | #elif defined(__ARM_ARCH_6__ ) || defined(__ARM_ARCH_6J__ ) \ |
570 | #elif defined(__ARM_ARCH_6__ ) || defined(__ARM_ARCH_6J__ ) \ |
571 | || defined(__ARM_ARCH_6K__) || defined(__ARM_ARCH_6ZK__) |
571 | || defined(__ARM_ARCH_6K__) || defined(__ARM_ARCH_6ZK__) |
572 | #define ECB_MEMORY_FENCE __asm__ __volatile__ ("mcr p15,0,%0,c7,c10,5" : : "r" (0) : "memory") |
572 | #define ECB_MEMORY_FENCE __asm__ __volatile__ ("mcr p15,0,%0,c7,c10,5" : : "r" (0) : "memory") |
573 | #elif defined(__ARM_ARCH_7__ ) || defined(__ARM_ARCH_7A__ ) \ |
573 | #elif defined(__ARM_ARCH_7__ ) || defined(__ARM_ARCH_7A__ ) \ |
574 | || defined(__ARM_ARCH_7M__) || defined(__ARM_ARCH_7R__ ) |
574 | || defined(__ARM_ARCH_7M__) || defined(__ARM_ARCH_7R__ ) |
575 | #define ECB_MEMORY_FENCE __asm__ __volatile__ ("dmb" : : : "memory") |
575 | #define ECB_MEMORY_FENCE __asm__ __volatile__ ("dmb" : : : "memory") |
576 | #elif __sparc || __sparc__ |
576 | #elif __sparc || __sparc__ |
577 | #define ECB_MEMORY_FENCE __asm__ __volatile__ ("membar #LoadStore | #LoadLoad | #StoreStore | #StoreLoad | " : : : "memory") |
577 | #define ECB_MEMORY_FENCE __asm__ __volatile__ ("membar #LoadStore | #LoadLoad | #StoreStore | #StoreLoad | " : : : "memory") |
578 | #define ECB_MEMORY_FENCE_ACQUIRE __asm__ __volatile__ ("membar #LoadStore | #LoadLoad" : : : "memory") |
578 | #define ECB_MEMORY_FENCE_ACQUIRE __asm__ __volatile__ ("membar #LoadStore | #LoadLoad" : : : "memory") |
579 | #define ECB_MEMORY_FENCE_RELEASE __asm__ __volatile__ ("membar #LoadStore | #StoreStore") |
579 | #define ECB_MEMORY_FENCE_RELEASE __asm__ __volatile__ ("membar #LoadStore | #StoreStore") |
580 | #elif defined(__s390__) || defined(__s390x__) |
580 | #elif defined(__s390__) || defined(__s390x__) |
581 | #define ECB_MEMORY_FENCE __asm__ __volatile__ ("bcr 15,0" : : : "memory") |
581 | #define ECB_MEMORY_FENCE __asm__ __volatile__ ("bcr 15,0" : : : "memory") |
|
|
582 | #elif defined(__mips__) |
|
|
583 | #define ECB_MEMORY_FENCE __asm__ __volatile__ ("sync" : : : "memory") |
582 | #endif |
584 | #endif |
583 | #endif |
585 | #endif |
584 | #endif |
586 | #endif |
585 | |
587 | |
586 | #ifndef ECB_MEMORY_FENCE |
588 | #ifndef ECB_MEMORY_FENCE |
… | |
… | |
599 | #elif __SUNPRO_C >= 0x5110 || __SUNPRO_CC >= 0x5110 |
601 | #elif __SUNPRO_C >= 0x5110 || __SUNPRO_CC >= 0x5110 |
600 | #include <mbarrier.h> |
602 | #include <mbarrier.h> |
601 | #define ECB_MEMORY_FENCE __machine_rw_barrier () |
603 | #define ECB_MEMORY_FENCE __machine_rw_barrier () |
602 | #define ECB_MEMORY_FENCE_ACQUIRE __machine_r_barrier () |
604 | #define ECB_MEMORY_FENCE_ACQUIRE __machine_r_barrier () |
603 | #define ECB_MEMORY_FENCE_RELEASE __machine_w_barrier () |
605 | #define ECB_MEMORY_FENCE_RELEASE __machine_w_barrier () |
|
|
606 | #elif __xlC__ |
|
|
607 | #define ECB_MEMORY_FENCE __sync () |
604 | #endif |
608 | #endif |
605 | #endif |
609 | #endif |
606 | |
610 | |
607 | #ifndef ECB_MEMORY_FENCE |
611 | #ifndef ECB_MEMORY_FENCE |
608 | #if !ECB_AVOID_PTHREADS |
612 | #if !ECB_AVOID_PTHREADS |
… | |
… | |
1328 | #if EV_USE_NANOSLEEP |
1332 | #if EV_USE_NANOSLEEP |
1329 | struct timespec ts; |
1333 | struct timespec ts; |
1330 | |
1334 | |
1331 | EV_TS_SET (ts, delay); |
1335 | EV_TS_SET (ts, delay); |
1332 | nanosleep (&ts, 0); |
1336 | nanosleep (&ts, 0); |
1333 | #elif defined(_WIN32) |
1337 | #elif defined _WIN32 |
1334 | Sleep ((unsigned long)(delay * 1e3)); |
1338 | Sleep ((unsigned long)(delay * 1e3)); |
1335 | #else |
1339 | #else |
1336 | struct timeval tv; |
1340 | struct timeval tv; |
1337 | |
1341 | |
1338 | /* here we rely on sys/time.h + sys/types.h + unistd.h providing select */ |
1342 | /* here we rely on sys/time.h + sys/types.h + unistd.h providing select */ |
… | |
… | |
1871 | /* win32 people keep sending patches that change this write() to send() */ |
1875 | /* win32 people keep sending patches that change this write() to send() */ |
1872 | /* and then run away. but send() is wrong, it wants a socket handle on win32 */ |
1876 | /* and then run away. but send() is wrong, it wants a socket handle on win32 */ |
1873 | /* so when you think this write should be a send instead, please find out */ |
1877 | /* so when you think this write should be a send instead, please find out */ |
1874 | /* where your send() is from - it's definitely not the microsoft send, and */ |
1878 | /* where your send() is from - it's definitely not the microsoft send, and */ |
1875 | /* tell me. thank you. */ |
1879 | /* tell me. thank you. */ |
|
|
1880 | /* it might be that your problem is that your environment needs EV_USE_WSASOCKET */ |
|
|
1881 | /* check the ev documentation on how to use this flag */ |
1876 | write (evpipe [1], &(evpipe [1]), 1); |
1882 | write (evpipe [1], &(evpipe [1]), 1); |
1877 | } |
1883 | } |
1878 | |
1884 | |
1879 | errno = old_errno; |
1885 | errno = old_errno; |
1880 | } |
1886 | } |
… | |
… | |
3735 | } |
3741 | } |
3736 | |
3742 | |
3737 | inline_size int |
3743 | inline_size int |
3738 | infy_newfd (void) |
3744 | infy_newfd (void) |
3739 | { |
3745 | { |
3740 | #if defined (IN_CLOEXEC) && defined (IN_NONBLOCK) |
3746 | #if defined IN_CLOEXEC && defined IN_NONBLOCK |
3741 | int fd = inotify_init1 (IN_CLOEXEC | IN_NONBLOCK); |
3747 | int fd = inotify_init1 (IN_CLOEXEC | IN_NONBLOCK); |
3742 | if (fd >= 0) |
3748 | if (fd >= 0) |
3743 | return fd; |
3749 | return fd; |
3744 | #endif |
3750 | #endif |
3745 | return inotify_init (); |
3751 | return inotify_init (); |