#include < sys/statvfs.h > #include < sys/types.h > #include < sys/stat.h > #include < fcntl.h > #include < stdio.h > int main() { int fd; struct statvfs buf; if((fd = open(".", O_RDONLY)) < 0){ perror("open"); return 1; } if (fstatvfs(fd, &buf) < 0){ perror("fstatvfs"); return 1; } printf( (sizeof(fsblkcnt_t) == 8) ?( "f_bsize = %lu, f_frsize = %lu,\n" "f_blocks = %llu, f_bfree = %llu, f_bavail = %llu, \n" "f_files = %llu, f_ffree = %llu, f_favail = %llu,\n" "f_fsid = %lx, f_flag= %lx, f_namemax = %lu\n" ) : ( "f_bsize = %lu, f_frsize = %lu,\n" "f_blocks = %llu, f_bfree = %lu, f_bavail = %lu, \n" "f_files = %lu, f_ffree = %lu, f_favail = %lu,\n" "f_fsid = %lx, f_flag= %lx, f_namemax = %lu\n" ), buf.f_bsize, buf.f_frsize, buf.f_blocks, buf.f_bfree, buf.f_bavail, buf.f_files, buf.f_ffree, buf.f_favail, buf.f_fsid, buf.f_flag, buf.f_namemax ); return 0; }