… | |
… | |
131 | |
131 | |
132 | If C<eio_poll ()> is configured to not handle all results in one go |
132 | If C<eio_poll ()> is configured to not handle all results in one go |
133 | (i.e. it returns C<-1>) then you should start an idle watcher that calls |
133 | (i.e. it returns C<-1>) then you should start an idle watcher that calls |
134 | C<eio_poll> until it returns something C<!= -1>. |
134 | C<eio_poll> until it returns something C<!= -1>. |
135 | |
135 | |
136 | A full-featured conenctor between libeio and libev would look as follows |
136 | A full-featured connector between libeio and libev would look as follows |
137 | (if C<eio_poll> is handling all requests, it can of course be simplified a |
137 | (if C<eio_poll> is handling all requests, it can of course be simplified a |
138 | lot by removing the idle watcher logic): |
138 | lot by removing the idle watcher logic): |
139 | |
139 | |
140 | static struct ev_loop *loop; |
140 | static struct ev_loop *loop; |
141 | static ev_idle repeat_watcher; |
141 | static ev_idle repeat_watcher; |
… | |
… | |
276 | |
276 | |
277 | =over 4 |
277 | =over 4 |
278 | |
278 | |
279 | =item eio_cancel (eio_req *req) |
279 | =item eio_cancel (eio_req *req) |
280 | |
280 | |
281 | Cancel the request (and all it's subrequests). If the request is currently |
281 | Cancel the request (and all its subrequests). If the request is currently |
282 | executing it might still continue to execute, and in other cases it might |
282 | executing it might still continue to execute, and in other cases it might |
283 | still take a while till the request is cancelled. |
283 | still take a while till the request is cancelled. |
284 | |
284 | |
285 | Even if cancelled, the finish callback will still be invoked - the |
285 | Even if cancelled, the finish callback will still be invoked - the |
286 | callbacks of all cancellable requests need to check whether the request |
286 | callbacks of all cancellable requests need to check whether the request |
… | |
… | |
405 | free (target); |
405 | free (target); |
406 | } |
406 | } |
407 | |
407 | |
408 | =item eio_realpath (const char *path, int pri, eio_cb cb, void *data) |
408 | =item eio_realpath (const char *path, int pri, eio_cb cb, void *data) |
409 | |
409 | |
410 | Similar to the realpath libc function, but unlike that one, result is |
410 | Similar to the realpath libc function, but unlike that one, C<< |
411 | C<-1> on failure and the length of the returned path in C<ptr2> (which is |
411 | req->result >> is C<-1> on failure. On success, the result is the length |
412 | not 0-terminated) - this is similar to readlink. |
412 | of the returned path in C<ptr2> (which is I<NOT> 0-terminated) - this is |
|
|
413 | similar to readlink. |
413 | |
414 | |
414 | =item eio_stat (const char *path, int pri, eio_cb cb, void *data) |
415 | =item eio_stat (const char *path, int pri, eio_cb cb, void *data) |
415 | |
416 | |
416 | =item eio_lstat (const char *path, int pri, eio_cb cb, void *data) |
417 | =item eio_lstat (const char *path, int pri, eio_cb cb, void *data) |
417 | |
418 | |
… | |
… | |
593 | as calling C<fdatasync>. |
594 | as calling C<fdatasync>. |
594 | |
595 | |
595 | Flags can be any combination of C<EIO_SYNC_FILE_RANGE_WAIT_BEFORE>, |
596 | Flags can be any combination of C<EIO_SYNC_FILE_RANGE_WAIT_BEFORE>, |
596 | C<EIO_SYNC_FILE_RANGE_WRITE> and C<EIO_SYNC_FILE_RANGE_WAIT_AFTER>. |
597 | C<EIO_SYNC_FILE_RANGE_WRITE> and C<EIO_SYNC_FILE_RANGE_WAIT_AFTER>. |
597 | |
598 | |
|
|
599 | =item eio_fallocate (int fd, int mode, off_t offset, off_t len, int pri, eio_cb cb, void *data) |
|
|
600 | |
|
|
601 | Calls C<fallocate> (note: I<NOT> C<posix_fallocate>!). If the syscall is |
|
|
602 | missing, then it returns failure and sets C<errno> to C<ENOSYS>. |
|
|
603 | |
|
|
604 | The C<mode> argument can be C<0> (for behaviour similar to |
|
|
605 | C<posix_fallocate>), or C<EIO_FALLOC_FL_KEEP_SIZE>, which keeps the size |
|
|
606 | of the file unchanged (but still preallocates space beyond end of file). |
|
|
607 | |
598 | =back |
608 | =back |
599 | |
609 | |
600 | =head3 LIBEIO-SPECIFIC REQUESTS |
610 | =head3 LIBEIO-SPECIFIC REQUESTS |
601 | |
611 | |
602 | These requests are specific to libeio and do not correspond to any OS call. |
612 | These requests are specific to libeio and do not correspond to any OS call. |