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.14 by root, Sun Nov 4 00:39:24 2007 UTC vs.
Revision 1.19 by root, Sun Nov 4 23:14:11 2007 UTC

40 ev.data.u64 = fd; /* use u64 to fully initialise the struct, for nicer strace etc. */ 40 ev.data.u64 = fd; /* use u64 to fully initialise the struct, for nicer strace etc. */
41 ev.events = 41 ev.events =
42 (nev & EV_READ ? EPOLLIN : 0) 42 (nev & EV_READ ? EPOLLIN : 0)
43 | (nev & EV_WRITE ? EPOLLOUT : 0); 43 | (nev & EV_WRITE ? EPOLLOUT : 0);
44 44
45 epoll_ctl (epoll_fd, mode, fd, &ev); 45 if (epoll_ctl (epoll_fd, mode, fd, &ev))
46} 46 if (errno != ENOENT /* on ENOENT the fd went away, so try to do the right thing */
47 47 || (nev && epoll_ctl (epoll_fd, EPOLL_CTL_ADD, fd, &ev)))
48static void 48 fd_kill (EV_A_ fd);
49epoll_postfork_child (EV_P)
50{
51 int fd;
52
53 epoll_fd = epoll_create (256);
54 fcntl (epoll_fd, F_SETFD, FD_CLOEXEC);
55
56 /* re-register interest in fds */
57 for (fd = 0; fd < anfdmax; ++fd)
58 if (anfds [fd].events)//D
59 epoll_modify (EV_A_ fd, EV_NONE, anfds [fd].events);
60} 49}
61 50
62static void 51static void
63epoll_poll (EV_P_ ev_tstamp timeout) 52epoll_poll (EV_P_ ev_tstamp timeout)
64{ 53{
103 epoll_events = malloc (sizeof (struct epoll_event) * epoll_eventmax); 92 epoll_events = malloc (sizeof (struct epoll_event) * epoll_eventmax);
104 93
105 return EVMETHOD_EPOLL; 94 return EVMETHOD_EPOLL;
106} 95}
107 96
97static void
98epoll_destroy (EV_P)
99{
100 close (epoll_fd);
101
102 free (epoll_events);
103}
104
105static void
106epoll_fork (EV_P)
107{
108 epoll_fd = epoll_create (256);
109 fcntl (epoll_fd, F_SETFD, FD_CLOEXEC);
110
111 fd_rearm_all (EV_A);
112}
113

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines