my $buf = "\0"x64;
my $path = "/etc/motd";
syscall(&SYS_statfs, $path, $buf) == 0 or die;
my ($bsize, $blocks, $bfree, $bavail, $files, $ffree, $namelen)
= unpack "x4 L6 x8 L", $buf;
print <<EOT;
Optimal transfer block size: $bsize
Blocks in file system: $blocks
Blocks free: $bfree (${\(int $bfree/$blocks*100)}%)
User blocks available: $bavail (${\(int $bavail/$blocks*100)}%)
Inodes: $files
Free inodes: $ffree (${\(int $ffree/$files*100)}%)
Maximum filename length: $namelen
EOT
|