… | |
… | |
51 | /*****************************************************************************/ |
51 | /*****************************************************************************/ |
52 | /* syscall wrapdadoop */ |
52 | /* syscall wrapdadoop */ |
53 | |
53 | |
54 | #include <sys/syscall.h> /* no glibc wrappers */ |
54 | #include <sys/syscall.h> /* no glibc wrappers */ |
55 | |
55 | |
56 | /* aio_abi.h is not verioned in any way, so we cannot test for its existance */ |
56 | /* aio_abi.h is not versioned in any way, so we cannot test for its existance */ |
57 | #define IOCB_CMD_POLL 5 |
57 | #define IOCB_CMD_POLL 5 |
58 | |
58 | |
59 | /* taken from linux/fs/aio.c */ |
59 | /* taken from linux/fs/aio.c */ |
60 | #define AIO_RING_MAGIC 0xa10a10a1 |
60 | #define AIO_RING_MAGIC 0xa10a10a1 |
61 | #define AIO_RING_INCOMPAT_FEATURES 0 |
61 | #define AIO_RING_INCOMPAT_FEATURES 0 |
… | |
… | |
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); /* always fails in relevant kernels */ |
153 | ev_io_cancel (linuxaio_ctx, &iocb->io, (struct io_event *)0); /* always returns an error 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; |
… | |
… | |
282 | /* This happens when the ring buffer is full, at least. I assume this means |
282 | /* This happens when the ring buffer is full, at least. I assume this means |
283 | * that the event was queued synchronously during io_submit, and thus |
283 | * that the event was queued synchronously during io_submit, and thus |
284 | * the buffer overflowd. |
284 | * the buffer overflowd. |
285 | * In this case, we just try next loop iteration. |
285 | * In this case, we just try next loop iteration. |
286 | */ |
286 | */ |
287 | memcpy (linuxaio_submits, linuxaio_submits + submitted, (linuxaio_submitcnt - submitted) * sizeof (*linuxaio_submits)); |
287 | memmove (linuxaio_submits, linuxaio_submits + submitted, (linuxaio_submitcnt - submitted) * sizeof (*linuxaio_submits)); |
288 | linuxaio_submitcnt -= submitted; |
288 | linuxaio_submitcnt -= submitted; |
289 | timeout = 0; |
289 | timeout = 0; |
290 | break; |
290 | break; |
291 | } |
291 | } |
292 | else |
292 | else |