… | |
… | |
148 | { |
148 | { |
149 | array_needsize (ANIOCBP, linuxaio_iocbps, linuxaio_iocbpmax, fd + 1, linuxaio_array_needsize_iocbp); |
149 | array_needsize (ANIOCBP, linuxaio_iocbps, linuxaio_iocbpmax, fd + 1, linuxaio_array_needsize_iocbp); |
150 | struct aniocb *iocb = linuxaio_iocbps [fd]; |
150 | struct aniocb *iocb = linuxaio_iocbps [fd]; |
151 | |
151 | |
152 | if (iocb->io.aio_buf) |
152 | if (iocb->io.aio_buf) |
153 | ev_io_cancel (linuxaio_ctx, &iocb->io, (struct io_event *)0); |
153 | ev_io_cancel (linuxaio_ctx, &iocb->io, (struct io_event *)0); /* always fails in relevant kernels */ |
154 | |
154 | |
155 | if (nev) |
155 | if (nev) |
156 | { |
156 | { |
157 | iocb->io.aio_data = fd; |
157 | iocb->io.aio_data = fd; |
158 | iocb->io.aio_fildes = fd; |
158 | iocb->io.aio_fildes = fd; |
… | |
… | |
311 | /* would be great to have a nice test for IOCB_CMD_POLL instead */ |
311 | /* would be great to have a nice test for IOCB_CMD_POLL instead */ |
312 | /* also: test some semi-common fd types, such as files and ttys in recommended_backends */ |
312 | /* also: test some semi-common fd types, such as files and ttys in recommended_backends */ |
313 | if (ev_linux_version () < 0x041200) /* 4.18 introduced IOCB_CMD_POLL */ |
313 | if (ev_linux_version () < 0x041200) /* 4.18 introduced IOCB_CMD_POLL */ |
314 | return 0; |
314 | return 0; |
315 | |
315 | |
|
|
316 | linuxaio_ctx = 0; |
316 | if (ev_io_setup (EV_LINUXAIO_DEPTH, &linuxaio_ctx) < 0) |
317 | if (ev_io_setup (EV_LINUXAIO_DEPTH, &linuxaio_ctx) < 0) |
317 | return 0; |
318 | return 0; |
318 | |
319 | |
319 | backend_modify = linuxaio_modify; |
320 | backend_modify = linuxaio_modify; |
320 | backend_poll = linuxaio_poll; |
321 | backend_poll = linuxaio_poll; |
… | |
… | |
342 | linuxaio_fork (EV_P) |
343 | linuxaio_fork (EV_P) |
343 | { |
344 | { |
344 | /* TODO: verify and test */ |
345 | /* TODO: verify and test */ |
345 | linuxaio_destroy (EV_A); |
346 | linuxaio_destroy (EV_A); |
346 | |
347 | |
|
|
348 | linuxaio_ctx = 0; |
347 | while (ev_io_setup (EV_LINUXAIO_DEPTH, &linuxaio_ctx) < 0) |
349 | while (ev_io_setup (EV_LINUXAIO_DEPTH, &linuxaio_ctx) < 0) |
348 | ev_syserr ("(libev) io_setup"); |
350 | ev_syserr ("(libev) io_setup"); |
349 | |
351 | |
350 | fd_rearm_all (EV_A); |
352 | fd_rearm_all (EV_A); |
351 | } |
353 | } |