… | |
… | |
110 | # define EV_USE_EPOLL 0 |
110 | # define EV_USE_EPOLL 0 |
111 | # endif |
111 | # endif |
112 | # endif |
112 | # endif |
113 | |
113 | |
114 | # ifndef EV_USE_KQUEUE |
114 | # ifndef EV_USE_KQUEUE |
115 | # if HAVE_KQUEUE && HAVE_SYS_EVENT_H && HAVE_SYS_QUEUE_H |
115 | # if HAVE_KQUEUE && HAVE_SYS_EVENT_H |
116 | # define EV_USE_KQUEUE 1 |
116 | # define EV_USE_KQUEUE 1 |
117 | # else |
117 | # else |
118 | # define EV_USE_KQUEUE 0 |
118 | # define EV_USE_KQUEUE 0 |
119 | # endif |
119 | # endif |
120 | # endif |
120 | # endif |
… | |
… | |
505 | |
505 | |
506 | #ifndef EV_FD_TO_WIN32_HANDLE |
506 | #ifndef EV_FD_TO_WIN32_HANDLE |
507 | # define EV_FD_TO_WIN32_HANDLE(fd) _get_osfhandle (fd) |
507 | # define EV_FD_TO_WIN32_HANDLE(fd) _get_osfhandle (fd) |
508 | #endif |
508 | #endif |
509 | #ifndef EV_WIN32_HANDLE_TO_FD |
509 | #ifndef EV_WIN32_HANDLE_TO_FD |
510 | # define EV_WIN32_HANDLE_TO_FD(handle) _open_osfhandle (fd, 0) |
510 | # define EV_WIN32_HANDLE_TO_FD(handle) _open_osfhandle (handle, 0) |
511 | #endif |
511 | #endif |
512 | #ifndef EV_WIN32_CLOSE_FD |
512 | #ifndef EV_WIN32_CLOSE_FD |
513 | # define EV_WIN32_CLOSE_FD(fd) close (fd) |
513 | # define EV_WIN32_CLOSE_FD(fd) close (fd) |
514 | #endif |
514 | #endif |
515 | |
515 | |
… | |
… | |
964 | /* check whether the given fd is atcually valid, for error recovery */ |
964 | /* check whether the given fd is atcually valid, for error recovery */ |
965 | inline_size int |
965 | inline_size int |
966 | fd_valid (int fd) |
966 | fd_valid (int fd) |
967 | { |
967 | { |
968 | #ifdef _WIN32 |
968 | #ifdef _WIN32 |
969 | return _get_osfhandle (fd) != -1; |
969 | return EV_FD_TO_WIN32_HANDLE (fd) != -1; |
970 | #else |
970 | #else |
971 | return fcntl (fd, F_GETFD) != -1; |
971 | return fcntl (fd, F_GETFD) != -1; |
972 | #endif |
972 | #endif |
973 | } |
973 | } |
974 | |
974 | |
… | |
… | |
1179 | inline_speed void |
1179 | inline_speed void |
1180 | fd_intern (int fd) |
1180 | fd_intern (int fd) |
1181 | { |
1181 | { |
1182 | #ifdef _WIN32 |
1182 | #ifdef _WIN32 |
1183 | unsigned long arg = 1; |
1183 | unsigned long arg = 1; |
1184 | ioctlsocket (_get_osfhandle (fd), FIONBIO, &arg); |
1184 | ioctlsocket (EV_FD_TO_WIN32_HANDLE (fd), FIONBIO, &arg); |
1185 | #else |
1185 | #else |
1186 | fcntl (fd, F_SETFD, FD_CLOEXEC); |
1186 | fcntl (fd, F_SETFD, FD_CLOEXEC); |
1187 | fcntl (fd, F_SETFL, O_NONBLOCK); |
1187 | fcntl (fd, F_SETFL, O_NONBLOCK); |
1188 | #endif |
1188 | #endif |
1189 | } |
1189 | } |
… | |
… | |
1294 | { |
1294 | { |
1295 | #if EV_MULTIPLICITY |
1295 | #if EV_MULTIPLICITY |
1296 | EV_P = signals [signum - 1].loop; |
1296 | EV_P = signals [signum - 1].loop; |
1297 | #endif |
1297 | #endif |
1298 | |
1298 | |
1299 | #if _WIN32 |
1299 | #ifdef _WIN32 |
1300 | signal (signum, ev_sighandler); |
1300 | signal (signum, ev_sighandler); |
1301 | #endif |
1301 | #endif |
1302 | |
1302 | |
1303 | signals [signum - 1].pending = 1; |
1303 | signals [signum - 1].pending = 1; |
1304 | evpipe_write (EV_A_ &sig_pending); |
1304 | evpipe_write (EV_A_ &sig_pending); |
… | |
… | |
2157 | ANHE_at_cache (*he); |
2157 | ANHE_at_cache (*he); |
2158 | } |
2158 | } |
2159 | } |
2159 | } |
2160 | |
2160 | |
2161 | /* fetch new monotonic and realtime times from the kernel */ |
2161 | /* fetch new monotonic and realtime times from the kernel */ |
2162 | /* also detetc if there was a timejump, and act accordingly */ |
2162 | /* also detect if there was a timejump, and act accordingly */ |
2163 | inline_speed void |
2163 | inline_speed void |
2164 | time_update (EV_P_ ev_tstamp max_block) |
2164 | time_update (EV_P_ ev_tstamp max_block) |
2165 | { |
2165 | { |
2166 | #if EV_USE_MONOTONIC |
2166 | #if EV_USE_MONOTONIC |
2167 | if (expect_true (have_monotonic)) |
2167 | if (expect_true (have_monotonic)) |
… | |
… | |
2747 | if (!((WL)w)->next) |
2747 | if (!((WL)w)->next) |
2748 | # if EV_USE_SIGNALFD |
2748 | # if EV_USE_SIGNALFD |
2749 | if (sigfd < 0) /*TODO*/ |
2749 | if (sigfd < 0) /*TODO*/ |
2750 | # endif |
2750 | # endif |
2751 | { |
2751 | { |
2752 | # if _WIN32 |
2752 | # ifdef _WIN32 |
2753 | evpipe_init (EV_A); |
2753 | evpipe_init (EV_A); |
2754 | |
2754 | |
2755 | signal (w->signum, ev_sighandler); |
2755 | signal (w->signum, ev_sighandler); |
2756 | # else |
2756 | # else |
2757 | struct sigaction sa; |
2757 | struct sigaction sa; |