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.70 by root, Mon Oct 12 17:53:17 2015 UTC vs.
Revision 1.73 by root, Thu Jun 20 22:44:59 2019 UTC

1/* 1/*
2 * libev epoll fd activity backend 2 * libev epoll fd activity backend
3 * 3 *
4 * Copyright (c) 2007,2008,2009,2010,2011 Marc Alexander Lehmann <libev@schmorp.de> 4 * Copyright (c) 2007,2008,2009,2010,2011,2016,2017,2019 Marc Alexander Lehmann <libev@schmorp.de>
5 * All rights reserved. 5 * All rights reserved.
6 * 6 *
7 * Redistribution and use in source and binary forms, with or without modifica- 7 * Redistribution and use in source and binary forms, with or without modifica-
8 * tion, are permitted provided that the following conditions are met: 8 * tion, are permitted provided that the following conditions are met:
9 * 9 *
122 anfds [fd].emask = EV_EMASK_EPERM; 122 anfds [fd].emask = EV_EMASK_EPERM;
123 123
124 /* add fd to epoll_eperms, if not already inside */ 124 /* add fd to epoll_eperms, if not already inside */
125 if (!(oldmask & EV_EMASK_EPERM)) 125 if (!(oldmask & EV_EMASK_EPERM))
126 { 126 {
127 array_needsize (int, epoll_eperms, epoll_epermmax, epoll_epermcnt + 1, EMPTY2); 127 array_needsize (int, epoll_eperms, epoll_epermmax, epoll_epermcnt + 1, array_needsize_noinit);
128 epoll_eperms [epoll_epermcnt++] = fd; 128 epoll_eperms [epoll_epermcnt++] = fd;
129 } 129 }
130 130
131 return; 131 return;
132 } 132 }
233 anfds [fd].emask = 0; 233 anfds [fd].emask = 0;
234 } 234 }
235 } 235 }
236} 236}
237 237
238int inline_size 238inline_size
239int
239epoll_init (EV_P_ int flags) 240epoll_init (EV_P_ int flags)
240{ 241{
241#ifdef EPOLL_CLOEXEC 242#if defined EPOLL_CLOEXEC && !defined __ANDROID__
242 backend_fd = epoll_create1 (EPOLL_CLOEXEC); 243 backend_fd = epoll_create1 (EPOLL_CLOEXEC);
243 244
244 if (backend_fd < 0 && (errno == EINVAL || errno == ENOSYS)) 245 if (backend_fd < 0 && (errno == EINVAL || errno == ENOSYS))
245#endif 246#endif
246 backend_fd = epoll_create (256); 247 backend_fd = epoll_create (256);
258 epoll_events = (struct epoll_event *)ev_malloc (sizeof (struct epoll_event) * epoll_eventmax); 259 epoll_events = (struct epoll_event *)ev_malloc (sizeof (struct epoll_event) * epoll_eventmax);
259 260
260 return EVBACKEND_EPOLL; 261 return EVBACKEND_EPOLL;
261} 262}
262 263
263void inline_size 264inline_size
265void
264epoll_destroy (EV_P) 266epoll_destroy (EV_P)
265{ 267{
266 ev_free (epoll_events); 268 ev_free (epoll_events);
267 array_free (epoll_eperm, EMPTY); 269 array_free (epoll_eperm, EMPTY);
268} 270}
269 271
270void inline_size 272inline_size
273void
271epoll_fork (EV_P) 274epoll_fork (EV_P)
272{ 275{
273 close (backend_fd); 276 close (backend_fd);
274 277
275 while ((backend_fd = epoll_create (256)) < 0) 278 while ((backend_fd = epoll_create (256)) < 0)

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines