… | |
… | |
363 | aio_stat "/etc/passwd", sub { |
363 | aio_stat "/etc/passwd", sub { |
364 | $_[0] and die "stat failed: $!"; |
364 | $_[0] and die "stat failed: $!"; |
365 | print "size is ", -s _, "\n"; |
365 | print "size is ", -s _, "\n"; |
366 | }; |
366 | }; |
367 | |
367 | |
|
|
368 | aio_statvfs $fh_or_path, $callback->($statvfs) |
|
|
369 | Works like the POSIX "statvfs" or "fstatvfs" syscalls, depending on |
|
|
370 | whether a file handle or path was passed. |
|
|
371 | |
|
|
372 | On success, the callback is passed a hash reference with the |
|
|
373 | following members: "bsize", "frsize", "blocks", "bfree", "bavail", |
|
|
374 | "files", "ffree", "favail", "fsid", "flag" and "namemax". On |
|
|
375 | failure, "undef" is passed. |
|
|
376 | |
|
|
377 | The following POSIX IO::AIO::ST_* constants are defined: "ST_RDONLY" |
|
|
378 | and "ST_NOSUID". |
|
|
379 | |
|
|
380 | The following non-POSIX IO::AIO::ST_* flag masks are defined to |
|
|
381 | their correct value when available, or to 0 on systems that do not |
|
|
382 | support them: "ST_NODEV", "ST_NOEXEC", "ST_SYNCHRONOUS", |
|
|
383 | "ST_MANDLOCK", "ST_WRITE", "ST_APPEND", "ST_IMMUTABLE", |
|
|
384 | "ST_NOATIME", "ST_NODIRATIME" and "ST_RELATIME". |
|
|
385 | |
|
|
386 | Example: stat "/wd" and dump out the data if successful. |
|
|
387 | |
|
|
388 | aio_statvfs "/wd", sub { |
|
|
389 | my $f = $_[0] |
|
|
390 | or die "statvfs: $!"; |
|
|
391 | |
|
|
392 | use Data::Dumper; |
|
|
393 | say Dumper $f; |
|
|
394 | }; |
|
|
395 | |
|
|
396 | # result: |
|
|
397 | { |
|
|
398 | bsize => 1024, |
|
|
399 | bfree => 4333064312, |
|
|
400 | blocks => 10253828096, |
|
|
401 | files => 2050765568, |
|
|
402 | flag => 4096, |
|
|
403 | favail => 2042092649, |
|
|
404 | bavail => 4333064312, |
|
|
405 | ffree => 2042092649, |
|
|
406 | namemax => 255, |
|
|
407 | frsize => 1024, |
|
|
408 | fsid => 1810 |
|
|
409 | } |
|
|
410 | |
368 | aio_utime $fh_or_path, $atime, $mtime, $callback->($status) |
411 | aio_utime $fh_or_path, $atime, $mtime, $callback->($status) |
369 | Works like perl's "utime" function (including the special case of |
412 | Works like perl's "utime" function (including the special case of |
370 | $atime and $mtime being undef). Fractional times are supported if |
413 | $atime and $mtime being undef). Fractional times are supported if |
371 | the underlying syscalls support them. |
414 | the underlying syscalls support them. |
372 | |
415 | |