This is repository of my old source code which isn't updated any more. Go to git.rot13.org for current projects!
ViewVC logotype

Contents of /perl/trunk/test/statfs.t

Parent Directory Parent Directory | Revision Log Revision Log

Revision 11 - (show annotations)
Sun Mar 20 00:37:31 2005 UTC (19 years, 1 month ago) by dpavlin
File MIME type: application/x-troff
File size: 659 byte(s)
Richard Dawe <rich(at)phekda(dot)gotadsl(dot)co(dot)uk>

Please find attached a patch that makes statfs.t pass on the x86_64
architecture. With Linux on x86_64 statfs returns 64-bit fields by default, so
the unpack format returns junk.

I also found that I would get a glibc warning about memory corruption. This is
because the statfs structure returned by the kernel includes some padding for
future expansion. So the statfs buffer also needed to be made bigger.

1 #!/usr/bin/perl
2 use test::helper qw($_real $_point);
3 use Test::More;
4 require 'syscall.ph'; # for SYS_statfs
5 plan tests => 7;
6 my ($statfs_data) = " " x 16;
7 my ($tmp) = $_point;
8 ok(!syscall(&SYS_statfs,$tmp,$statfs_data),"statfs");
9 # FIXME: this is soooooo linux-centric. perhaps parse the output of /bin/df?
10 my @list = unpack("L!7L2L!7",$statfs_data);
11 print join(', ', @list)."\n";
12 shift(@list);
13 is(shift(@list),4096,"block size");
14 is(shift(@list),1000000,"blocks");
15 is(shift(@list),500000,"blocks free");
16 shift(@list);
17 is(shift(@list),1000000,"files");
18 is(shift(@list),500000,"files free");
19 shift(@list);
20 shift(@list);
21 is(shift(@list),255,"namelen");

  ViewVC Help
Powered by ViewVC 1.1.26