2002-07-23 10:17:58

by Abraham vd Merwe

[permalink] [raw]
Subject: Fwd: [[email protected]: Re: [CLUG-tech] statfs() vs. df]

Hi!

Can anyone explain this? He's got 2.4.2 with libc6 2.2.x. df -k returns the
correct results for his partition. Both statfs() and statvfs() returns bogus
values. From his last email it looks like it's actually returning stats for
/dev/hda8 instead of /dev/hda9.

Is this a (known) bug?

Here is the source for the program mentioned in the email:

------------< snip <------< snip <------< snip <------------
root@crystal:~# cat /tmp/t.c

#include <stdio.h>
#include <sys/vfs.h>
#include <sys/statvfs.h>

static const char part[] = "/dev/hda9";

int main ()
{
struct statfs stat;
struct statvfs vfs;

if (statfs (part,&stat) < 0) {
perror ("statfs");
return(1);
}
printf("f_blocks: %ld, f_bsize: %d\n",stat.f_blocks,stat.f_bsize);

if (statvfs (part,&vfs) < 0) {
perror ("statvfs");
return(1);
}
printf("f_bsize: %lu, f_blocks: %lu\n",vfs.f_bsize,vfs.f_blocks);

return(0);
}

------------< snip <------< snip <------< snip <------------

--

Regards
Abraham

Avoid Quiet and Placid persons unless you are in Need of Sleep.
-- National Lampoon, "Deteriorata"

__________________________________________________________
Abraham vd Merwe - 2d3D, Inc.

Device Driver Development, Outsourcing, Embedded Systems

Cell: +27 82 565 4451 Snailmail:
Tel: +27 21 761 7549 Block C, Aintree Park
Fax: +27 21 761 7648 Doncaster Road
Email: [email protected] Kenilworth, 7700
Http: http://www.2d3d.com South Africa


Attachments:
(No filename) (0.00 B)
(No filename) (232.00 B)
Download all attachments