… | |
… | |
1658 | * our syscalls return < 0, not == -1, on error. which is good |
1658 | * our syscalls return < 0, not == -1, on error. which is good |
1659 | * enough for linux aio. |
1659 | * enough for linux aio. |
1660 | * TODO: arm is also common nowadays, maybe even mips and x86 |
1660 | * TODO: arm is also common nowadays, maybe even mips and x86 |
1661 | * TODO: after implementing this, it suddenly looks like overkill, but its hard to remove... |
1661 | * TODO: after implementing this, it suddenly looks like overkill, but its hard to remove... |
1662 | */ |
1662 | */ |
1663 | #if __GNUC__ && __linux && ECB_AMD64 && !defined __OPTIMIZE_SIZE__ |
1663 | #if __GNUC__ && __linux && ECB_AMD64 && !EV_FEATURE_CODE |
1664 | /* the costly errno access probably kills this for size optimisation */ |
1664 | /* the costly errno access probably kills this for size optimisation */ |
1665 | |
1665 | |
1666 | #define ev_syscall(nr,narg,arg1,arg2,arg3,arg4,arg5,arg6) \ |
1666 | #define ev_syscall(nr,narg,arg1,arg2,arg3,arg4,arg5,arg6) \ |
1667 | ({ \ |
1667 | ({ \ |
1668 | long res; \ |
1668 | long res; \ |
… | |
… | |
2262 | inline_size void |
2262 | inline_size void |
2263 | fd_reify (EV_P) |
2263 | fd_reify (EV_P) |
2264 | { |
2264 | { |
2265 | int i; |
2265 | int i; |
2266 | |
2266 | |
|
|
2267 | /* most backends do not modify the fdchanges list in backend_modfiy. |
|
|
2268 | * except io_uring, which has fixed-size buffers which might force us |
|
|
2269 | * to handle events in backend_modify, causing fdchangesd to be amended, |
|
|
2270 | * which could result in an endless loop. |
|
|
2271 | * to avoid this, we do not dynamically handle fds that were added |
|
|
2272 | * during fd_reify. that menas thast for those backends, fdchangecnt |
|
|
2273 | * might be non-zero during poll, which must cause them to not block. |
|
|
2274 | * to not put too much of a burden on other backends, this detail |
|
|
2275 | * needs to be handled in the backend. |
|
|
2276 | */ |
|
|
2277 | int changecnt = fdchangecnt; |
|
|
2278 | |
2267 | #if EV_SELECT_IS_WINSOCKET || EV_USE_IOCP |
2279 | #if EV_SELECT_IS_WINSOCKET || EV_USE_IOCP |
2268 | for (i = 0; i < fdchangecnt; ++i) |
2280 | for (i = 0; i < changecnt; ++i) |
2269 | { |
2281 | { |
2270 | int fd = fdchanges [i]; |
2282 | int fd = fdchanges [i]; |
2271 | ANFD *anfd = anfds + fd; |
2283 | ANFD *anfd = anfds + fd; |
2272 | |
2284 | |
2273 | if (anfd->reify & EV__IOFDSET && anfd->head) |
2285 | if (anfd->reify & EV__IOFDSET && anfd->head) |
… | |
… | |
2287 | } |
2299 | } |
2288 | } |
2300 | } |
2289 | } |
2301 | } |
2290 | #endif |
2302 | #endif |
2291 | |
2303 | |
2292 | for (i = 0; i < fdchangecnt; ++i) |
2304 | for (i = 0; i < changecnt; ++i) |
2293 | { |
2305 | { |
2294 | int fd = fdchanges [i]; |
2306 | int fd = fdchanges [i]; |
2295 | ANFD *anfd = anfds + fd; |
2307 | ANFD *anfd = anfds + fd; |
2296 | ev_io *w; |
2308 | ev_io *w; |
2297 | |
2309 | |
… | |
… | |
2313 | |
2325 | |
2314 | if (o_reify & EV__IOFDSET) |
2326 | if (o_reify & EV__IOFDSET) |
2315 | backend_modify (EV_A_ fd, o_events, anfd->events); |
2327 | backend_modify (EV_A_ fd, o_events, anfd->events); |
2316 | } |
2328 | } |
2317 | |
2329 | |
|
|
2330 | /* normally, fdchangecnt hasn't changed. if it has, then new fds have been added. |
|
|
2331 | * this is a rare case (see beginning comment in this function), so we copy them to the |
|
|
2332 | * front and hope the backend handles this case. |
|
|
2333 | */ |
|
|
2334 | if (ecb_expect_false (fdchangecnt != changecnt)) |
|
|
2335 | memmove (fdchanges, fdchanges + changecnt, (fdchangecnt - changecnt) * sizeof (*fdchanges)); |
|
|
2336 | |
2318 | fdchangecnt = 0; |
2337 | fdchangecnt -= changecnt; |
2319 | } |
2338 | } |
2320 | |
2339 | |
2321 | /* something about the given fd changed */ |
2340 | /* something about the given fd changed */ |
2322 | inline_size |
2341 | inline_size |
2323 | void |
2342 | void |