… | |
… | |
91 | /*****************************************************************************/ |
91 | /*****************************************************************************/ |
92 | /* syscall wrapdadoop - this section has the raw api/abi definitions */ |
92 | /* syscall wrapdadoop - this section has the raw api/abi definitions */ |
93 | |
93 | |
94 | #include <sys/syscall.h> /* no glibc wrappers */ |
94 | #include <sys/syscall.h> /* no glibc wrappers */ |
95 | |
95 | |
96 | /* aio_abi.h is not versioned in any way, so we cannot test for its existance */ |
96 | /* aio_abi.h is not versioned in any way, so we cannot test for its existence */ |
97 | #define IOCB_CMD_POLL 5 |
97 | #define IOCB_CMD_POLL 5 |
98 | |
98 | |
99 | /* taken from linux/fs/aio.c. yup, that's a .c file. |
99 | /* taken from linux/fs/aio.c. yup, that's a .c file. |
100 | * not only is this totally undocumented, not even the source code |
100 | * not only is this totally undocumented, not even the source code |
101 | * can tell you what the future semantics of compat_features and |
101 | * can tell you what the future semantics of compat_features and |
… | |
… | |
268 | |
268 | |
269 | /* increment generation counter to avoid handling old events */ |
269 | /* increment generation counter to avoid handling old events */ |
270 | ++anfd->egen; |
270 | ++anfd->egen; |
271 | } |
271 | } |
272 | |
272 | |
273 | iocb->io.aio_buf = |
273 | iocb->io.aio_buf = (nev & EV_READ ? POLLIN : 0) |
274 | (nev & EV_READ ? POLLIN : 0) |
|
|
275 | | (nev & EV_WRITE ? POLLOUT : 0); |
274 | | (nev & EV_WRITE ? POLLOUT : 0); |
276 | |
275 | |
277 | if (nev) |
276 | if (nev) |
278 | { |
277 | { |
279 | iocb->io.aio_data = (uint32_t)fd | ((__u64)(uint32_t)anfd->egen << 32); |
278 | iocb->io.aio_data = (uint32_t)fd | ((__u64)(uint32_t)anfd->egen << 32); |
280 | |
279 | |
… | |
… | |
567 | { |
566 | { |
568 | epoll_destroy (EV_A); |
567 | epoll_destroy (EV_A); |
569 | return 0; |
568 | return 0; |
570 | } |
569 | } |
571 | |
570 | |
572 | ev_io_init (EV_A_ &linuxaio_epoll_w, linuxaio_epoll_cb, backend_fd, EV_READ); |
571 | ev_io_init (&linuxaio_epoll_w, linuxaio_epoll_cb, backend_fd, EV_READ); |
573 | ev_set_priority (&linuxaio_epoll_w, EV_MAXPRI); |
572 | ev_set_priority (&linuxaio_epoll_w, EV_MAXPRI); |
574 | ev_io_start (EV_A_ &linuxaio_epoll_w); |
573 | ev_io_start (EV_A_ &linuxaio_epoll_w); |
575 | ev_unref (EV_A); /* watcher should not keep loop alive */ |
574 | ev_unref (EV_A); /* watcher should not keep loop alive */ |
576 | |
575 | |
577 | backend_modify = linuxaio_modify; |
576 | backend_modify = linuxaio_modify; |