Unix Programming - How can I get the size of free space of a logical volume in c language?

This is Interesting: Free IT Magazines  
Home > Archive > Unix Programming > June 2005 > How can I get the size of free space of a logical volume in c language?





You are viewing an archived Text-only version of the thread. To view this thread in it's original format and/or if you want to reply to this thread please [click here]

Author How can I get the size of free space of a logical volume in c language?
HamburgerWang@gmail.com

2005-06-14, 8:52 pm

Are there any functions in c's library or unix's library?
And the header file name?
By the way, what function can read the size of a file quickly(not open
it)?

Mat

2005-06-15, 7:48 am


Free space for a mounted partition:
statfs ( sys/vfs.h )
[ struct statfs - f_bfree * f_blocks ]

Size of a file:
stat ( sys/types.h, sys/stat.h, unistd.h )
[ struct stat - st_size ]

HamburgerWang@gmail.com

2005-06-15, 8:59 pm

Thanks,
but i got the values in HP UNIX:
f_bfree 418506
f_blocks 1540096
f_bsize 1024
418506 * 1024 = 428550114

while i use shell command, i got 393817kbytes
when i turned to use f_bavail, i got it.
Is it right?

Sponsored Links






Free braindumps | Software forum | Database administration forum

Copyright 2003 - 2008 webservertalk.com