… | |
… | |
707 | events |= (unsigned char)w->events; |
707 | events |= (unsigned char)w->events; |
708 | |
708 | |
709 | #if EV_SELECT_IS_WINSOCKET |
709 | #if EV_SELECT_IS_WINSOCKET |
710 | if (events) |
710 | if (events) |
711 | { |
711 | { |
712 | unsigned long argp; |
712 | unsigned long arg; |
713 | #ifdef EV_FD_TO_WIN32_HANDLE |
713 | #ifdef EV_FD_TO_WIN32_HANDLE |
714 | anfd->handle = EV_FD_TO_WIN32_HANDLE (fd); |
714 | anfd->handle = EV_FD_TO_WIN32_HANDLE (fd); |
715 | #else |
715 | #else |
716 | anfd->handle = _get_osfhandle (fd); |
716 | anfd->handle = _get_osfhandle (fd); |
717 | #endif |
717 | #endif |
718 | assert (("libev only supports socket fds in this configuration", ioctlsocket (anfd->handle, FIONREAD, &argp) == 0)); |
718 | assert (("libev only supports socket fds in this configuration", ioctlsocket (anfd->handle, FIONREAD, &arg) == 0)); |
719 | } |
719 | } |
720 | #endif |
720 | #endif |
721 | |
721 | |
722 | { |
722 | { |
723 | unsigned char o_events = anfd->events; |
723 | unsigned char o_events = anfd->events; |
… | |
… | |
776 | { |
776 | { |
777 | int fd; |
777 | int fd; |
778 | |
778 | |
779 | for (fd = 0; fd < anfdmax; ++fd) |
779 | for (fd = 0; fd < anfdmax; ++fd) |
780 | if (anfds [fd].events) |
780 | if (anfds [fd].events) |
781 | if (!fd_valid (fd) == -1 && errno == EBADF) |
781 | if (!fd_valid (fd) && errno == EBADF) |
782 | fd_kill (EV_A_ fd); |
782 | fd_kill (EV_A_ fd); |
783 | } |
783 | } |
784 | |
784 | |
785 | /* called on ENOMEM in select/poll to kill some fds and retry */ |
785 | /* called on ENOMEM in select/poll to kill some fds and retry */ |
786 | static void noinline |
786 | static void noinline |
… | |
… | |
983 | |
983 | |
984 | void inline_speed |
984 | void inline_speed |
985 | fd_intern (int fd) |
985 | fd_intern (int fd) |
986 | { |
986 | { |
987 | #ifdef _WIN32 |
987 | #ifdef _WIN32 |
988 | int arg = 1; |
988 | unsigned long arg = 1; |
989 | ioctlsocket (_get_osfhandle (fd), FIONBIO, &arg); |
989 | ioctlsocket (_get_osfhandle (fd), FIONBIO, &arg); |
990 | #else |
990 | #else |
991 | fcntl (fd, F_SETFD, FD_CLOEXEC); |
991 | fcntl (fd, F_SETFD, FD_CLOEXEC); |
992 | fcntl (fd, F_SETFL, O_NONBLOCK); |
992 | fcntl (fd, F_SETFL, O_NONBLOCK); |
993 | #endif |
993 | #endif |