ViewVC Help
View File | Revision Log | Show Annotations | Download File
/cvs/libev/ev.c
(Generate patch)

Comparing libev/ev.c (file contents):
Revision 1.253 by root, Sat May 31 03:13:27 2008 UTC vs.
Revision 1.256 by root, Thu Jun 19 06:53:49 2008 UTC

154#ifndef _WIN32 154#ifndef _WIN32
155# include <sys/time.h> 155# include <sys/time.h>
156# include <sys/wait.h> 156# include <sys/wait.h>
157# include <unistd.h> 157# include <unistd.h>
158#else 158#else
159# include <io.h>
159# define WIN32_LEAN_AND_MEAN 160# define WIN32_LEAN_AND_MEAN
160# include <windows.h> 161# include <windows.h>
161# ifndef EV_SELECT_IS_WINSOCKET 162# ifndef EV_SELECT_IS_WINSOCKET
162# define EV_SELECT_IS_WINSOCKET 1 163# define EV_SELECT_IS_WINSOCKET 1
163# endif 164# endif
707 events |= (unsigned char)w->events; 708 events |= (unsigned char)w->events;
708 709
709#if EV_SELECT_IS_WINSOCKET 710#if EV_SELECT_IS_WINSOCKET
710 if (events) 711 if (events)
711 { 712 {
712 unsigned long argp; 713 unsigned long arg;
713 #ifdef EV_FD_TO_WIN32_HANDLE 714 #ifdef EV_FD_TO_WIN32_HANDLE
714 anfd->handle = EV_FD_TO_WIN32_HANDLE (fd); 715 anfd->handle = EV_FD_TO_WIN32_HANDLE (fd);
715 #else 716 #else
716 anfd->handle = _get_osfhandle (fd); 717 anfd->handle = _get_osfhandle (fd);
717 #endif 718 #endif
718 assert (("libev only supports socket fds in this configuration", ioctlsocket (anfd->handle, FIONREAD, &argp) == 0)); 719 assert (("libev only supports socket fds in this configuration", ioctlsocket (anfd->handle, FIONREAD, &arg) == 0));
719 } 720 }
720#endif 721#endif
721 722
722 { 723 {
723 unsigned char o_events = anfd->events; 724 unsigned char o_events = anfd->events;
776{ 777{
777 int fd; 778 int fd;
778 779
779 for (fd = 0; fd < anfdmax; ++fd) 780 for (fd = 0; fd < anfdmax; ++fd)
780 if (anfds [fd].events) 781 if (anfds [fd].events)
781 if (!fd_valid (fd) == -1 && errno == EBADF) 782 if (!fd_valid (fd) && errno == EBADF)
782 fd_kill (EV_A_ fd); 783 fd_kill (EV_A_ fd);
783} 784}
784 785
785/* called on ENOMEM in select/poll to kill some fds and retry */ 786/* called on ENOMEM in select/poll to kill some fds and retry */
786static void noinline 787static void noinline
983 984
984void inline_speed 985void inline_speed
985fd_intern (int fd) 986fd_intern (int fd)
986{ 987{
987#ifdef _WIN32 988#ifdef _WIN32
988 int arg = 1; 989 unsigned long arg = 1;
989 ioctlsocket (_get_osfhandle (fd), FIONBIO, &arg); 990 ioctlsocket (_get_osfhandle (fd), FIONBIO, &arg);
990#else 991#else
991 fcntl (fd, F_SETFD, FD_CLOEXEC); 992 fcntl (fd, F_SETFD, FD_CLOEXEC);
992 fcntl (fd, F_SETFL, O_NONBLOCK); 993 fcntl (fd, F_SETFL, O_NONBLOCK);
993#endif 994#endif
2567 } 2568 }
2568 2569
2569 } 2570 }
2570} 2571}
2571 2572
2573#endif
2574
2575#ifdef _WIN32
2576# define EV_LSTAT(p,b) _stati64 (p, b)
2577#else
2578# define EV_LSTAT(p,b) lstat (p, b)
2572#endif 2579#endif
2573 2580
2574void 2581void
2575ev_stat_stat (EV_P_ ev_stat *w) 2582ev_stat_stat (EV_P_ ev_stat *w)
2576{ 2583{

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines