… | |
… | |
336 | break; |
336 | break; |
337 | } |
337 | } |
338 | #if EPOLL_FALLBACK |
338 | #if EPOLL_FALLBACK |
339 | else if (errno == EINVAL) |
339 | else if (errno == EINVAL) |
340 | { |
340 | { |
341 | /* This hapΓΌpens for unsupported fds, officially, but in my testing, |
341 | /* This happens for unsupported fds, officially, but in my testing, |
342 | * also randomly happens for supported fds. We fall back to good old |
342 | * also randomly happens for supported fds. We fall back to good old |
343 | * poll() here, under the assumption that this is a very rare case. |
343 | * poll() here, under the assumption that this is a very rare case. |
|
|
344 | * See https://lore.kernel.org/patchwork/patch/1047453/ for evidence |
|
|
345 | * that the problem is known, but ignored. |
344 | */ |
346 | */ |
345 | struct iocb *iocb = linuxaio_submits [submitted]; |
347 | struct iocb *iocb = linuxaio_submits [submitted]; |
346 | res = 1; /* skip this iocb */ |
348 | res = 1; /* skip this iocb */ |
347 | |
349 | |
348 | linuxaio_rearm_epoll (EV_A_ iocb, EPOLL_CTL_ADD); |
350 | linuxaio_rearm_epoll (EV_A_ iocb, EPOLL_CTL_ADD); |
… | |
… | |
404 | int |
406 | int |
405 | linuxaio_init (EV_P_ int flags) |
407 | linuxaio_init (EV_P_ int flags) |
406 | { |
408 | { |
407 | /* would be great to have a nice test for IOCB_CMD_POLL instead */ |
409 | /* would be great to have a nice test for IOCB_CMD_POLL instead */ |
408 | /* also: test some semi-common fd types, such as files and ttys in recommended_backends */ |
410 | /* also: test some semi-common fd types, such as files and ttys in recommended_backends */ |
409 | if (ev_linux_version () < 0x041200) /* 4.18 introduced IOCB_CMD_POLL */ |
411 | #if EPOLL_FALLBACK |
|
|
412 | /* 4.19 made epoll work */ |
|
|
413 | if (ev_linux_version () < 0x041300) |
410 | return 0; |
414 | return 0; |
|
|
415 | #else |
|
|
416 | /* 4.18 introduced IOCB_CMD_POLL */ |
|
|
417 | if (ev_linux_version () < 0x041200) |
|
|
418 | return 0; |
|
|
419 | #endif |
411 | |
420 | |
412 | linuxaio_ctx = 0; |
421 | linuxaio_ctx = 0; |
413 | if (ev_io_setup (EV_LINUXAIO_DEPTH, &linuxaio_ctx) < 0) |
422 | if (ev_io_setup (EV_LINUXAIO_DEPTH, &linuxaio_ctx) < 0) |
414 | return 0; |
423 | return 0; |
415 | |
424 | |