… | |
… | |
242 | They are the same as used by "sysopen". |
242 | They are the same as used by "sysopen". |
243 | |
243 | |
244 | Likewise, $mode specifies the mode of the newly created file, if it |
244 | Likewise, $mode specifies the mode of the newly created file, if it |
245 | didn't exist and "O_CREAT" has been given, just like perl's |
245 | didn't exist and "O_CREAT" has been given, just like perl's |
246 | "sysopen", except that it is mandatory (i.e. use 0 if you don't |
246 | "sysopen", except that it is mandatory (i.e. use 0 if you don't |
247 | create new files, and 0666 or 0777 if you do). |
247 | create new files, and 0666 or 0777 if you do). Note that the $mode |
|
|
248 | will be modified by the umask in effect then the request is being |
|
|
249 | executed, so better never change the umask. |
248 | |
250 | |
249 | Example: |
251 | Example: |
250 | |
252 | |
251 | aio_open "/etc/passwd", O_RDONLY, 0, sub { |
253 | aio_open "/etc/passwd", O_RDONLY, 0, sub { |
252 | if ($_[0]) { |
254 | if ($_[0]) { |
… | |
… | |
373 | |
375 | |
374 | aio_rename $srcpath, $dstpath, $callback->($status) |
376 | aio_rename $srcpath, $dstpath, $callback->($status) |
375 | Asynchronously rename the object at $srcpath to $dstpath, just as |
377 | Asynchronously rename the object at $srcpath to $dstpath, just as |
376 | rename(2) and call the callback with the result code. |
378 | rename(2) and call the callback with the result code. |
377 | |
379 | |
|
|
380 | aio_mkdir $pathname, $mode, $callback->($status) |
|
|
381 | Asynchronously mkdir (create) a directory and call the callback with |
|
|
382 | the result code. $mode will be modified by the umask at the time the |
|
|
383 | request is executed, so do not change your umask. |
|
|
384 | |
378 | aio_rmdir $pathname, $callback->($status) |
385 | aio_rmdir $pathname, $callback->($status) |
379 | Asynchronously rmdir (delete) a directory and call the callback with |
386 | Asynchronously rmdir (delete) a directory and call the callback with |
380 | the result code. |
387 | the result code. |
381 | |
388 | |
382 | aio_readdir $pathname, $callback->($entries) |
389 | aio_readdir $pathname, $callback->($entries) |
… | |
… | |
465 | |
472 | |
466 | It will also likely work on non-POSIX filesystems with reduced |
473 | It will also likely work on non-POSIX filesystems with reduced |
467 | efficiency as those tend to return 0 or 1 as link counts, which |
474 | efficiency as those tend to return 0 or 1 as link counts, which |
468 | disables the directory counting heuristic. |
475 | disables the directory counting heuristic. |
469 | |
476 | |
|
|
477 | aio_rmtree $path, $callback->($status) |
|
|
478 | Delete a directory tree starting (and including) $path, return the |
|
|
479 | status of the final "rmdir" only. This is a composite request that |
|
|
480 | uses "aio_scandir" to recurse into and rmdir directories, and unlink |
|
|
481 | everything else. |
|
|
482 | |
470 | aio_fsync $fh, $callback->($status) |
483 | aio_fsync $fh, $callback->($status) |
471 | Asynchronously call fsync on the given filehandle and call the |
484 | Asynchronously call fsync on the given filehandle and call the |
472 | callback with the fsync result code. |
485 | callback with the fsync result code. |
473 | |
486 | |
474 | aio_fdatasync $fh, $callback->($status) |
487 | aio_fdatasync $fh, $callback->($status) |