statvfs problem

Hi,

I’m having a problem getting the number of free blocks using statvfs() on
QNX RTP 6.00
The program below seems to get the total amount of blocks, but the number of
free blocks available
is always 0.

i.e.

#df /dev/hd0t79
/dev/hd0t79 3951360 824819 3126541 21% /

but

#./statvfs /dev/hd0t79
total blocks 3951360
free blocks 0
avail blocks 0

The system I am running on is x86, the size of fsblkcnt_t is reported as 4,
so I assume it’s a u32_t

Any help appreciated

Regards
akeane@quadrics.com

/* cc -o statvfs statvfs.c */
#include <unistd.h>
#include <stdlib.h>
#include <stdio.h>

#include <sys/types.h>
#include <sys/statvfs.h>


int main(int argc, char *argv[])
{
struct statvfs fs;

if ( statvfs(argv[1], &fs) == -1)
{
perror(“statvfs”);
return -1;
}

printf(“total blocks %d\n”, fs.f_blocks);
printf(“free blocks %d\n”, fs.f_bfree);
printf(“avail blocks %d\n”, fs.f_bavail);

return 0;
}