… | |
… | |
315 | |
315 | |
316 | This call tries to make use of a native "sendfile" syscall to |
316 | This call tries to make use of a native "sendfile" syscall to |
317 | provide zero-copy operation. For this to work, $out_fh should refer |
317 | provide zero-copy operation. For this to work, $out_fh should refer |
318 | to a socket, and $in_fh should refer to mmap'able file. |
318 | to a socket, and $in_fh should refer to mmap'able file. |
319 | |
319 | |
320 | If the native sendfile call fails or is not implemented, it will be |
320 | If a native sendfile cannot be found or it fails with "ENOSYS", |
|
|
321 | "ENOTSUP", "EOPNOTSUPP", "EAFNOSUPPORT", "EPROTOTYPE" or "ENOTSOCK", |
321 | emulated, so you can call "aio_sendfile" on any type of filehandle |
322 | it will be emulated, so you can call "aio_sendfile" on any type of |
322 | regardless of the limitations of the operating system. |
323 | filehandle regardless of the limitations of the operating system. |
323 | |
324 | |
324 | Please note, however, that "aio_sendfile" can read more bytes from |
325 | Please note, however, that "aio_sendfile" can read more bytes from |
325 | $in_fh than are written, and there is no way to find out how many |
326 | $in_fh than are written, and there is no way to find out how many |
326 | bytes have been read from "aio_sendfile" alone, as "aio_sendfile" |
327 | bytes have been read from "aio_sendfile" alone, as "aio_sendfile" |
327 | only provides the number of bytes written to $out_fh. Only if the |
328 | only provides the number of bytes written to $out_fh. Only if the |
… | |
… | |
636 | Future versions of this function might fall back to other methods |
637 | Future versions of this function might fall back to other methods |
637 | when "fsync" on the directory fails (such as calling "sync"). |
638 | when "fsync" on the directory fails (such as calling "sync"). |
638 | |
639 | |
639 | Passes 0 when everything went ok, and -1 on error. |
640 | Passes 0 when everything went ok, and -1 on error. |
640 | |
641 | |
|
|
642 | aio_msync $scalar, $offset = 0, $length = undef, flags = 0, |
|
|
643 | $callback->($status) |
|
|
644 | This is a rather advanced IO::AIO call, which only works on |
|
|
645 | mmap(2)ed scalars (see the Sys::Mmap or Mmap modules for details on |
|
|
646 | this, note that the scalar must only be modified in-place while an |
|
|
647 | aio operation is pending on it). |
|
|
648 | |
|
|
649 | It calls the "msync" function of your OS, if available, with the |
|
|
650 | memory area starting at $offset in the string and ending $length |
|
|
651 | bytes later. If $length is negative, counts from the end, and if |
|
|
652 | $length is "undef", then it goes till the end of the string. The |
|
|
653 | flags can be a combination of "IO::AIO::MS_ASYNC", |
|
|
654 | "IO::AIO::MS_INVALIDATE" and "IO::AIO::MS_SYNC". |
|
|
655 | |
|
|
656 | aio_mtouch $scalar, $offset = 0, $length = undef, flags = 0, |
|
|
657 | $callback->($status) |
|
|
658 | This is a rather advanced IO::AIO call, which works best on |
|
|
659 | mmap(2)ed scalars. |
|
|
660 | |
|
|
661 | It touches (reads or writes) all memory pages in the specified range |
|
|
662 | inside the scalar. All caveats and parameters are the same as for |
|
|
663 | "aio_msync", above, except for flags, which must be either 0 (which |
|
|
664 | reads all pages and ensures they are instantiated) or |
|
|
665 | "IO::AIO::MT_MODIFY", which modifies the memory page s(by reading |
|
|
666 | and writing an octet from it, which dirties the page). |
|
|
667 | |
641 | aio_group $callback->(...) |
668 | aio_group $callback->(...) |
642 | This is a very special aio request: Instead of doing something, it |
669 | This is a very special aio request: Instead of doing something, it |
643 | is a container for other aio requests, which is useful if you want |
670 | is a container for other aio requests, which is useful if you want |
644 | to bundle many requests into a single, composite, request with a |
671 | to bundle many requests into a single, composite, request with a |
645 | definite callback and the ability to cancel the whole request with |
672 | definite callback and the ability to cancel the whole request with |
… | |
… | |
760 | |
787 | |
761 | $grp->cancel_subs |
788 | $grp->cancel_subs |
762 | Cancel all subrequests and clears any feeder, but not the group |
789 | Cancel all subrequests and clears any feeder, but not the group |
763 | request itself. Useful when you queued a lot of events but got a |
790 | request itself. Useful when you queued a lot of events but got a |
764 | result early. |
791 | result early. |
|
|
792 | |
|
|
793 | The group request will finish normally (you cannot add requests to |
|
|
794 | the group). |
765 | |
795 | |
766 | $grp->result (...) |
796 | $grp->result (...) |
767 | Set the result value(s) that will be passed to the group callback |
797 | Set the result value(s) that will be passed to the group callback |
768 | when all subrequests have finished and set the groups errno to the |
798 | when all subrequests have finished and set the groups errno to the |
769 | current value of errno (just like calling "errno" without an error |
799 | current value of errno (just like calling "errno" without an error |