summaryrefslogtreecommitdiffstats
path: root/lib
diff options
context:
space:
mode:
authorThierry Vignaud <tv@mandriva.org>2009-10-07 17:13:49 +0000
committerThierry Vignaud <tv@mandriva.org>2009-10-07 17:13:49 +0000
commit4116489d18c572826e532dce89c4cfe78dc67eba (patch)
tree86244b32e3d94bcd5c8ea9be3c3cad5b3dd88aac /lib
parent84b97eba7dd428d5d4cab85852d313c6ee294935 (diff)
downloadperl-MDK-Common-4116489d18c572826e532dce89c4cfe78dc67eba.tar
perl-MDK-Common-4116489d18c572826e532dce89c4cfe78dc67eba.tar.gz
perl-MDK-Common-4116489d18c572826e532dce89c4cfe78dc67eba.tar.bz2
perl-MDK-Common-4116489d18c572826e532dce89c4cfe78dc67eba.tar.xz
perl-MDK-Common-4116489d18c572826e532dce89c4cfe78dc67eba.zip
use a more portable df()
Diffstat (limited to 'lib')
-rw-r--r--lib/MDK/Common/System.pm14
1 files changed, 3 insertions, 11 deletions
diff --git a/lib/MDK/Common/System.pm b/lib/MDK/Common/System.pm
index f7d0f63..bd13629 100644
--- a/lib/MDK/Common/System.pm
+++ b/lib/MDK/Common/System.pm
@@ -307,17 +307,9 @@ sub syscall_ {
#- return the size of the partition and its free space in KiB
sub df {
my ($mntpoint) = @_;
- my ($blocksize, $size, $free);
- my $buf = ' ' x 20000;
- syscall_('statfs', $mntpoint, $buf) or return;
- # at least on mips the statfs structure is different to x86
- # Should we use bavail or bfree ?
- if (arch() =~ /mips/) {
- (undef, $blocksize, undef, $size, $free, undef, undef, $avail) = unpack "L!8", $buf;
- } else {
- (undef, $blocksize, $size, $free, undef, undef) = unpack "L!6", $buf;
- }
- map { $_ * ($blocksize / 1024) } $size, $free;
+ require Filesys::Df;
+ my $df = Filesys::Df::df("/", 1024); # ask 1kb values
+ @$df{qw(blocks bfree)};
}
sub sync() { syscall_('sync') }