ViewVC Help
View File | Revision Log | Show Annotations | Download File
/cvs/Linux-AIO/README
(Generate patch)

Comparing Linux-AIO/README (file contents):
Revision 1.4 by root, Sun Jul 10 01:02:51 2005 UTC vs.
Revision 1.7 by root, Wed Aug 17 16:57:53 2005 UTC

2 Linux::AIO - linux-specific aio implemented using clone 2 Linux::AIO - linux-specific aio implemented using clone
3 3
4SYNOPSIS 4SYNOPSIS
5 use Linux::AIO; 5 use Linux::AIO;
6 6
7 # This module has been mostly superseded by IO::AIO.
8
7DESCRIPTION 9DESCRIPTION
10 *This module has been mostly superseded by IO::AIO, which is API
11 compatible.*
12
8 This module implements asynchronous I/O using the means available to 13 This module implements asynchronous I/O using the means available to
9 Linux - clone. It does not hook into the POSIX aio_* functions because 14 Linux - clone. It does not hook into the POSIX aio_* functions because
10 Linux does not yet support these in the kernel (even as of 2.6.12, only 15 Linux does not yet support these in the kernel (even as of 2.6.12, only
11 O_DIRECT files are supported) and even if, it would only allow aio_read 16 O_DIRECT files are supported) and even if, it would only allow aio_read
12 and write, not open, stat and so on. 17 and write, not open, stat and so on.
33 syscall has been executed asynchronously. 38 syscall has been executed asynchronously.
34 39
35 All functions that expect a filehandle will also accept a file 40 All functions that expect a filehandle will also accept a file
36 descriptor. 41 descriptor.
37 42
43 The filenames you pass to these routines *must* be absolute. The reason
44 is that at the time the request is being executed, the current working
45 directory could have changed. Alternatively, you can make sure that you
46 never change the current working directory.
47
38 Linux::AIO::min_parallel $nthreads 48 Linux::AIO::min_parallel $nthreads
39 Set the minimum number of AIO threads to $nthreads. The default is 49 Set the minimum number of AIO threads to $nthreads. The default is
40 1, which means a single asynchronous operation can be done at one 50 1, which means a single asynchronous operation can be done at one
41 time (the number of outstanding operations, however, is unlimited). 51 time (the number of outstanding operations, however, is unlimited).
42 52
87 Linux::AIO::nreqs 97 Linux::AIO::nreqs
88 Returns the number of requests currently outstanding. 98 Returns the number of requests currently outstanding.
89 99
90 Example: wait till there are no outstanding requests anymore: 100 Example: wait till there are no outstanding requests anymore:
91 101
92 Linux::AIO::poll_wait while Linux::AIO::nreqs; 102 Linux::AIO::poll_wait, Linux::AIO::poll_cb
103 while Linux::AIO::nreqs;
93 104
94 aio_open $pathname, $flags, $mode, $callback 105 aio_open $pathname, $flags, $mode, $callback
95 Asynchronously open or create a file and call the callback with the 106 Asynchronously open or create a file and call the callback with the
96 filedescriptor (NOT a perl filehandle, sorry for that, but watch 107 filedescriptor (NOT a perl filehandle, sorry for that, but watch
97 out, this might change in the future). 108 out, this might change in the future).
98 109
110 The pathname passed to "aio_open" must be absolute. See API NOTES,
111 above, for an explanation.
112
99 The $mode argument is a bitmask. See the "Fcntl" module for a list. 113 The $mode argument is a bitmask. See the "Fcntl" module for a list.
100 They are the same as used in "sysopen". 114 They are the same as used in "sysopen".
101 115
102 Example: 116 Example:
103 117
104 aio_open "/etc/passwd", O_RDONLY, 0, sub { 118 aio_open "/etc/passwd", O_RDONLY, 0, sub {
105 if ($_[0] >= 0) { 119 if ($_[0] >= 0) {
106 open my $fh, "<&$_[0]"; # create a copy for perl 120 open my $fh, "<&=$_[0]";
107 aio_close $_[0], sub { }; # close the aio handle
108 print "open successful, fh is $fh\n"; 121 print "open successful, fh is $fh\n";
109 ... 122 ...
110 } else { 123 } else {
111 die "open failed: $!\n"; 124 die "open failed: $!\n";
112 } 125 }
149 aio_lstat $fh, $callback 162 aio_lstat $fh, $callback
150 Works like perl's "stat" or "lstat" in void context. The callback 163 Works like perl's "stat" or "lstat" in void context. The callback
151 will be called after the stat and the results will be available 164 will be called after the stat and the results will be available
152 using "stat _" or "-s _" etc... 165 using "stat _" or "-s _" etc...
153 166
167 The pathname passed to "aio_stat" must be absolute. See API NOTES,
168 above, for an explanation.
169
154 Currently, the stats are always 64-bit-stats, i.e. instead of 170 Currently, the stats are always 64-bit-stats, i.e. instead of
155 returning an error when stat'ing a large file, the results will be 171 returning an error when stat'ing a large file, the results will be
156 silently truncated unless perl itself is compiled with large file 172 silently truncated unless perl itself is compiled with large file
157 support. 173 support.
158 174
180 webserver for many years now. 196 webserver for many years now.
181 197
182 - aio_open gives a fd, but all other functions expect a perl filehandle. 198 - aio_open gives a fd, but all other functions expect a perl filehandle.
183 199
184SEE ALSO 200SEE ALSO
185 Coro. 201 Coro, IO::AIO.
186 202
187AUTHOR 203AUTHOR
188 Marc Lehmann <schmorp@schmorp.de> 204 Marc Lehmann <schmorp@schmorp.de>
189 http://home.schmorp.de/ 205 http://home.schmorp.de/
190 206

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines