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

Comparing libev/ev_epoll.c (file contents):
Revision 1.5 by root, Wed Oct 31 14:44:15 2007 UTC vs.
Revision 1.6 by root, Wed Oct 31 20:46:44 2007 UTC

43 | (nev & EV_WRITE ? EPOLLOUT : 0); 43 | (nev & EV_WRITE ? EPOLLOUT : 0);
44 44
45 epoll_ctl (epoll_fd, mode, fd, &ev); 45 epoll_ctl (epoll_fd, mode, fd, &ev);
46} 46}
47 47
48static void
48void epoll_postfork_child (void) 49epoll_postfork_child (void)
49{ 50{
50 int fd; 51 int fd;
51 52
52 epoll_fd = epoll_create (256); 53 epoll_fd = epoll_create (256);
53 fcntl (epoll_fd, F_SETFD, FD_CLOEXEC); 54 fcntl (epoll_fd, F_SETFD, FD_CLOEXEC);
59} 60}
60 61
61static struct epoll_event *events; 62static struct epoll_event *events;
62static int eventmax; 63static int eventmax;
63 64
65static void
64static void epoll_poll (ev_tstamp timeout) 66epoll_poll (ev_tstamp timeout)
65{ 67{
66 int eventcnt = epoll_wait (epoll_fd, events, eventmax, ceil (timeout * 1000.)); 68 int eventcnt = epoll_wait (epoll_fd, events, eventmax, ceil (timeout * 1000.));
67 int i; 69 int i;
68 70
69 if (eventcnt < 0) 71 if (eventcnt < 0)
83 eventmax += eventmax >> 1; 85 eventmax += eventmax >> 1;
84 events = malloc (sizeof (struct epoll_event) * eventmax); 86 events = malloc (sizeof (struct epoll_event) * eventmax);
85 } 87 }
86} 88}
87 89
90static void
88void epoll_init (int flags) 91epoll_init (int flags)
89{ 92{
90 epoll_fd = epoll_create (256); 93 epoll_fd = epoll_create (256);
91 94
92 if (epoll_fd < 0) 95 if (epoll_fd < 0)
93 return; 96 return;
100 method_poll = epoll_poll; 103 method_poll = epoll_poll;
101 104
102 eventmax = 64; /* intiial number of events receivable per poll */ 105 eventmax = 64; /* intiial number of events receivable per poll */
103 events = malloc (sizeof (struct epoll_event) * eventmax); 106 events = malloc (sizeof (struct epoll_event) * eventmax);
104} 107}
108

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines