… | |
… | |
36 | usually delivers "false") as it's sole argument when the given syscall has |
36 | usually delivers "false") as it's sole argument when the given syscall has |
37 | been executed asynchronously. |
37 | been executed asynchronously. |
38 | |
38 | |
39 | All functions that expect a filehandle will also accept a file descriptor. |
39 | All functions that expect a filehandle will also accept a file descriptor. |
40 | |
40 | |
|
|
41 | The filenames you pass to these routines I<must> be absolute. The reason |
|
|
42 | is that at the time the request is being executed, the current working |
|
|
43 | directory could have changed. Alternatively, you can make sure that you |
|
|
44 | never change the current workign directory. |
|
|
45 | |
41 | =over 4 |
46 | =over 4 |
42 | |
47 | |
43 | =cut |
48 | =cut |
44 | |
49 | |
45 | package Linux::AIO; |
50 | package Linux::AIO; |
… | |
… | |
114 | |
119 | |
115 | Returns the number of requests currently outstanding. |
120 | Returns the number of requests currently outstanding. |
116 | |
121 | |
117 | Example: wait till there are no outstanding requests anymore: |
122 | Example: wait till there are no outstanding requests anymore: |
118 | |
123 | |
119 | Linux::AIO::poll_wait while Linux::AIO::nreqs; |
124 | Linux::AIO::poll_wait, Linux::AIO::poll_cb |
|
|
125 | while Linux::AIO::nreqs; |
120 | |
126 | |
121 | =item aio_open $pathname, $flags, $mode, $callback |
127 | =item aio_open $pathname, $flags, $mode, $callback |
122 | |
128 | |
123 | Asynchronously open or create a file and call the callback with the |
129 | Asynchronously open or create a file and call the callback with the |
124 | filedescriptor (NOT a perl filehandle, sorry for that, but watch out, this |
130 | filedescriptor (NOT a perl filehandle, sorry for that, but watch out, this |
… | |
… | |
181 | |
187 | |
182 | Works like perl's C<stat> or C<lstat> in void context. The callback will |
188 | Works like perl's C<stat> or C<lstat> in void context. The callback will |
183 | be called after the stat and the results will be available using C<stat _> |
189 | be called after the stat and the results will be available using C<stat _> |
184 | or C<-s _> etc... |
190 | or C<-s _> etc... |
185 | |
191 | |
|
|
192 | The pathname passed to C<aio_stat> must be absolute. See API NOTES, above, |
|
|
193 | for an explanation. |
|
|
194 | |
186 | Currently, the stats are always 64-bit-stats, i.e. instead of returning an |
195 | Currently, the stats are always 64-bit-stats, i.e. instead of returning an |
187 | error when stat'ing a large file, the results will be silently truncated |
196 | error when stat'ing a large file, the results will be silently truncated |
188 | unless perl itself is compiled with large file support. |
197 | unless perl itself is compiled with large file support. |
189 | |
198 | |
190 | Example: Print the length of F</etc/passwd>: |
199 | Example: Print the length of F</etc/passwd>: |