… | |
… | |
133 | |
133 | |
134 | aio_read $fh, 7, 15, $buffer, 0, sub { |
134 | aio_read $fh, 7, 15, $buffer, 0, sub { |
135 | $_[0] > 0 or die "read error: $!"; |
135 | $_[0] > 0 or die "read error: $!"; |
136 | print "read $_[0] bytes: <$buffer>\n"; |
136 | print "read $_[0] bytes: <$buffer>\n"; |
137 | }; |
137 | }; |
|
|
138 | |
|
|
139 | aio_move $srcpath, $dstpath, $callback->($status) |
|
|
140 | [EXPERIMENTAL] |
|
|
141 | |
|
|
142 | Try to move the *file* (directories not supported as either source |
|
|
143 | or destination) from $srcpath to $dstpath and call the callback with |
|
|
144 | the 0 (error) or -1 ok. |
|
|
145 | |
|
|
146 | This is a composite request that tries to rename(2) the file first. |
|
|
147 | If rename files with "EXDEV", it creates the destination file with |
|
|
148 | mode 0200 and copies the contents of the source file into it using |
|
|
149 | "aio_sendfile", followed by restoring atime, mtime, access mode and |
|
|
150 | uid/gid, in that order, and unlinking the $srcpath. |
|
|
151 | |
|
|
152 | If an error occurs, the partial destination file will be unlinked, |
|
|
153 | if possible, except when setting atime, mtime, access mode and |
|
|
154 | uid/gid, where errors are being ignored. |
138 | |
155 | |
139 | aio_sendfile $out_fh, $in_fh, $in_offset, $length, $callback->($retval) |
156 | aio_sendfile $out_fh, $in_fh, $in_offset, $length, $callback->($retval) |
140 | Tries to copy $length bytes from $in_fh to $out_fh. It starts |
157 | Tries to copy $length bytes from $in_fh to $out_fh. It starts |
141 | reading at byte offset $in_offset, and starts writing at the current |
158 | reading at byte offset $in_offset, and starts writing at the current |
142 | file offset of $out_fh. Because of that, it is not safe to issue |
159 | file offset of $out_fh. Because of that, it is not safe to issue |
… | |
… | |
196 | |
213 | |
197 | aio_unlink $pathname, $callback->($status) |
214 | aio_unlink $pathname, $callback->($status) |
198 | Asynchronously unlink (delete) a file and call the callback with the |
215 | Asynchronously unlink (delete) a file and call the callback with the |
199 | result code. |
216 | result code. |
200 | |
217 | |
|
|
218 | aio_link $srcpath, $dstpath, $callback->($status) |
|
|
219 | Asynchronously create a new link to the existing object at $srcpath |
|
|
220 | at the path $dstpath and call the callback with the result code. |
|
|
221 | |
|
|
222 | aio_symlink $srcpath, $dstpath, $callback->($status) |
|
|
223 | Asynchronously create a new symbolic link to the existing object at |
|
|
224 | $srcpath at the path $dstpath and call the callback with the result |
|
|
225 | code. |
|
|
226 | |
|
|
227 | aio_rename $srcpath, $dstpath, $callback->($status) |
|
|
228 | Asynchronously rename the object at $srcpath to $dstpath, just as |
|
|
229 | rename(2) and call the callback with the result code. |
|
|
230 | |
201 | aio_rmdir $pathname, $callback->($status) |
231 | aio_rmdir $pathname, $callback->($status) |
202 | Asynchronously rmdir (delete) a directory and call the callback with |
232 | Asynchronously rmdir (delete) a directory and call the callback with |
203 | the result code. |
233 | the result code. |
204 | |
234 | |
205 | aio_readdir $pathname, $callback->($entries) |
235 | aio_readdir $pathname, $callback->($entries) |