1 | /* |
1 | /* |
2 | * libev epoll fd activity backend |
2 | * libev epoll fd activity backend |
3 | * |
3 | * |
4 | * Copyright (c) 2007,2008 Marc Alexander Lehmann <libev@schmorp.de> |
4 | * Copyright (c) 2007,2008,2009 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 | * |
… | |
… | |
179 | } |
179 | } |
180 | |
180 | |
181 | int inline_size |
181 | int inline_size |
182 | epoll_init (EV_P_ int flags) |
182 | epoll_init (EV_P_ int flags) |
183 | { |
183 | { |
|
|
184 | #ifdef EPOLL_CLOEXEC |
|
|
185 | backend_fd = epoll_create1 (EPOLL_CLOEXEC); |
|
|
186 | |
|
|
187 | if (backend_fd <= 0) |
|
|
188 | #endif |
184 | backend_fd = epoll_create (256); |
189 | backend_fd = epoll_create (256); |
185 | |
190 | |
186 | if (backend_fd < 0) |
191 | if (backend_fd < 0) |
187 | return 0; |
192 | return 0; |
188 | |
193 | |
189 | fcntl (backend_fd, F_SETFD, FD_CLOEXEC); |
194 | fcntl (backend_fd, F_SETFD, FD_CLOEXEC); |