… | |
… | |
152 | print "read $_[0] bytes: <$buffer>\n"; |
152 | print "read $_[0] bytes: <$buffer>\n"; |
153 | }; |
153 | }; |
154 | |
154 | |
155 | =item aio_readahead $fh,$offset,$length, $callback |
155 | =item aio_readahead $fh,$offset,$length, $callback |
156 | |
156 | |
157 | Asynchronously reads the specified byte range into the page cache, using |
|
|
158 | the C<readahead> syscall. If that syscall doesn't exist (likely if your OS |
|
|
159 | isn't Linux) the status will be C<-1> and C<$!> is set to C<ENOSYS>. |
|
|
160 | |
|
|
161 | C<aio_readahead> populates the page cache with data from a file so that |
157 | C<aio_readahead> populates the page cache with data from a file so that |
162 | subsequent reads from that file will not block on disk I/O. The C<$offset> |
158 | subsequent reads from that file will not block on disk I/O. The C<$offset> |
163 | argument specifies the starting point from which data is to be read and |
159 | argument specifies the starting point from which data is to be read and |
164 | C<$length> specifies the number of bytes to be read. I/O is performed in |
160 | C<$length> specifies the number of bytes to be read. I/O is performed in |
165 | whole pages, so that offset is effectively rounded down to a page boundary |
161 | whole pages, so that offset is effectively rounded down to a page boundary |
166 | and bytes are read up to the next page boundary greater than or equal to |
162 | and bytes are read up to the next page boundary greater than or equal to |
167 | (off-set+length). C<aio_readahead> does not read beyond the end of the |
163 | (off-set+length). C<aio_readahead> does not read beyond the end of the |
168 | file. The current file offset of the file is left unchanged. |
164 | file. The current file offset of the file is left unchanged. |
169 | |
165 | |
|
|
166 | If that syscall doesn't exist (likely if your OS isn't Linux) it will be |
|
|
167 | emulated by simply reading the data, which would have a similar effect. |
|
|
168 | |
170 | =item aio_stat $fh_or_path, $callback |
169 | =item aio_stat $fh_or_path, $callback |
171 | |
170 | |
172 | =item aio_lstat $fh, $callback |
171 | =item aio_lstat $fh, $callback |
173 | |
172 | |
174 | Works like perl's C<stat> or C<lstat> in void context. The callback will |
173 | Works like perl's C<stat> or C<lstat> in void context. The callback will |
… | |
… | |
200 | with the fsync result code. |
199 | with the fsync result code. |
201 | |
200 | |
202 | =item aio_fdatasync $fh, $callback |
201 | =item aio_fdatasync $fh, $callback |
203 | |
202 | |
204 | Asynchronously call fdatasync on the given filehandle and call the |
203 | Asynchronously call fdatasync on the given filehandle and call the |
205 | callback with the fdatasync result code. Might set C<$!> to C<ENOSYS> if |
204 | callback with the fdatasync result code. |
206 | C<fdatasync> is not available. |
205 | |
|
|
206 | If this call isn't available because your OS lacks it or it couldn't be |
|
|
207 | detected, it will be emulated by calling C<fsync> instead. |
207 | |
208 | |
208 | =back |
209 | =back |
209 | |
210 | |
210 | =head2 SUPPORT FUNCTIONS |
211 | =head2 SUPPORT FUNCTIONS |
211 | |
212 | |