… | |
… | |
25 | similar functions, as well as less rarely ones such as C<mknod>, C<futime> |
25 | similar functions, as well as less rarely ones such as C<mknod>, C<futime> |
26 | or C<readlink>. |
26 | or C<readlink>. |
27 | |
27 | |
28 | It also offers wrappers around C<sendfile> (Solaris, Linux, HP-UX and |
28 | It also offers wrappers around C<sendfile> (Solaris, Linux, HP-UX and |
29 | FreeBSD, with emulation on other platforms) and C<readahead> (Linux, with |
29 | FreeBSD, with emulation on other platforms) and C<readahead> (Linux, with |
30 | emulation elsewhere>). |
30 | emulation elsewhere). |
31 | |
31 | |
32 | The goal is to enable you to write fully non-blocking programs. For |
32 | The goal is to enable you to write fully non-blocking programs. For |
33 | example, in a game server, you would not want to freeze for a few seconds |
33 | example, in a game server, you would not want to freeze for a few seconds |
34 | just because the server is running a backup and you happen to call |
34 | just because the server is running a backup and you happen to call |
35 | C<readdir>. |
35 | C<readdir>. |
… | |
… | |
233 | |
233 | |
234 | The C<void *data> member simply stores the value of the C<data> argument. |
234 | The C<void *data> member simply stores the value of the C<data> argument. |
235 | |
235 | |
236 | =back |
236 | =back |
237 | |
237 | |
238 | Memmbers not explicitly described as accessible must not be |
238 | Members not explicitly described as accessible must not be |
239 | accessed. Specifically, there is no gurantee that any members will still |
239 | accessed. Specifically, there is no guarantee that any members will still |
240 | have the value they had when the request was submitted. |
240 | have the value they had when the request was submitted. |
241 | |
241 | |
242 | The return value of the callback is normally C<0>, which tells libeio to |
242 | The return value of the callback is normally C<0>, which tells libeio to |
243 | continue normally. If a callback returns a nonzero value, libeio will |
243 | continue normally. If a callback returns a nonzero value, libeio will |
244 | stop processing results (in C<eio_poll>) and will return the value to its |
244 | stop processing results (in C<eio_poll>) and will return the value to its |
… | |
… | |
630 | |
630 | |
631 | =over 4 |
631 | =over 4 |
632 | |
632 | |
633 | =item eio_mtouch (void *addr, size_t length, int flags, int pri, eio_cb cb, void *data) |
633 | =item eio_mtouch (void *addr, size_t length, int flags, int pri, eio_cb cb, void *data) |
634 | |
634 | |
635 | Reads (C<flags == 0>) or modifies (C<flags == EIO_MT_MODIFY) the given |
635 | Reads (C<flags == 0>) or modifies (C<flags == EIO_MT_MODIFY>) the given |
636 | memory area, page-wise, that is, it reads (or reads and writes back) the |
636 | memory area, page-wise, that is, it reads (or reads and writes back) the |
637 | first octet of every page that spans the memory area. |
637 | first octet of every page that spans the memory area. |
638 | |
638 | |
639 | This can be used to page in some mmapped file, or dirty some pages. Note |
639 | This can be used to page in some mmapped file, or dirty some pages. Note |
640 | that dirtying is an unlocked read-write access, so races can ensue when |
640 | that dirtying is an unlocked read-write access, so races can ensue when |
… | |
… | |
764 | request finish on its own. |
764 | request finish on its own. |
765 | |
765 | |
766 | =item 3) open callback adds more requests |
766 | =item 3) open callback adds more requests |
767 | |
767 | |
768 | In the open callback, if the open was not successful, copy C<< |
768 | In the open callback, if the open was not successful, copy C<< |
769 | req->errorno >> to C<< grp->errorno >> and set C<< grp->errorno >> to |
769 | req->errorno >> to C<< grp->errorno >> and set C<< grp->result >> to |
770 | C<-1> to signal an error. |
770 | C<-1> to signal an error. |
771 | |
771 | |
772 | Otherwise, malloc some memory or so and issue a read request, adding the |
772 | Otherwise, malloc some memory or so and issue a read request, adding the |
773 | read request to the group. |
773 | read request to the group. |
774 | |
774 | |
775 | =item 4) continue issuing requests till finished |
775 | =item 4) continue issuing requests till finished |
776 | |
776 | |
777 | In the real callback, check for errors and possibly continue with |
777 | In the read callback, check for errors and possibly continue with |
778 | C<eio_close> or any other eio request in the same way. |
778 | C<eio_close> or any other eio request in the same way. |
779 | |
779 | |
780 | As soon as no new requests are added the group request will finish. Make |
780 | As soon as no new requests are added, the group request will finish. Make |
781 | sure you I<always> set C<< grp->result >> to some sensible value. |
781 | sure you I<always> set C<< grp->result >> to some sensible value. |
782 | |
782 | |
783 | =back |
783 | =back |
784 | |
784 | |
785 | =head4 REQUEST LIMITING |
785 | =head4 REQUEST LIMITING |
… | |
… | |
787 | |
787 | |
788 | #TODO |
788 | #TODO |
789 | |
789 | |
790 | void eio_grp_limit (eio_req *grp, int limit); |
790 | void eio_grp_limit (eio_req *grp, int limit); |
791 | |
791 | |
792 | |
|
|
793 | =back |
|
|
794 | |
792 | |
795 | |
793 | |
796 | =head1 LOW LEVEL REQUEST API |
794 | =head1 LOW LEVEL REQUEST API |
797 | |
795 | |
798 | #TODO |
796 | #TODO |
… | |
… | |
926 | This symbol governs the stack size for each eio thread. Libeio itself |
924 | This symbol governs the stack size for each eio thread. Libeio itself |
927 | was written to use very little stackspace, but when using C<EIO_CUSTOM> |
925 | was written to use very little stackspace, but when using C<EIO_CUSTOM> |
928 | requests, you might want to increase this. |
926 | requests, you might want to increase this. |
929 | |
927 | |
930 | If this symbol is undefined (the default) then libeio will use its default |
928 | If this symbol is undefined (the default) then libeio will use its default |
931 | stack size (C<sizeof (void *) * 4096> currently). If it is defined, but |
929 | stack size (C<sizeof (void *) * 4096> currently). In all other cases, the |
932 | C<0>, then the default operating system stack size will be used. In all |
|
|
933 | other cases, the value must be an expression that evaluates to the desired |
930 | value must be an expression that evaluates to the desired stack size. |
934 | stack size. |
|
|
935 | |
931 | |
936 | =back |
932 | =back |
937 | |
933 | |
938 | |
934 | |
939 | =head1 PORTABILITY REQUIREMENTS |
935 | =head1 PORTABILITY REQUIREMENTS |