NAME

Filesys::Df - Perl extension for obtaining file system stats.

SYNOPSIS

use Filesys::Df;
$ref=df('/tmp');
print"Percent Full: $ref->{PER}\n";
print"Super User Blocks: $ref->{SU_BLOCKS}\n";
print"Super User Blocks Used: $ref->{SU_USED}\n";
print"Super User Blocks Available: $ref->{SU_BAVAIL}\n";
print"User Blocks: $ref->{USER_BLOCKS}\n";
print"User Blocks Used: $ref->{USER_USED}\n";
print"User Blocks Available: $ref->{USER_BAVAIL}\n";

DESCRIPTION

This module will produce info on a filesystem for both the normal disk space and the amount reserved for the super-user. It contains one function df(), which takes a directory as the first argument and an optional second argument which will let you specify the block size for the output. The return value is a refrence to a hash.

The keys of intrest in this hash are:

PER Percent used. This is based on what the normal user will have available.

SU_BLOCKS Total number of blocks (Available to super-user).

SU_USED Total number of used blocks (Available to super-user).

SU_BAVAIL Total number of avaliable blocks (Available to super-user).

USED_BLOCKS Total number of blocks (Available non super-user).

USER_USED Total number of used blocks (Available to non super-user).

USER_BAVAIL Total number of avaliable blocks (Available to non super-user).

Most 'df' applications will print out the SU_BLOCKS or USER_BLOCKS, USER_BAVAIL, SU_USED, and the percent full. So you will probably end up using these values the most.

If the file system does not contain a diffrential in space for the super-user then you can use the non user specific keys: BLOCKS, USED, and BAVAIL. Also the USER_ keys will contain the same values as the SU_ keys.

If there was an error df() will return undef.

Requirements: Your system must contain statvfs(). You must be running perl.5003 or higher.

Note: I based the way the percent full is measured based on what the HP-UX application 'bdf' returns. The 'bdf' application seems to round a bit different than 'df' does but I like 'bdf' so that is what I based the percentages on.

AUTHOR

Ian Guthrie IGuthrie@aol.com

SEE ALSO

statvfs(2), df(1M), bdf(1M)

perl(1).