# HG changeset patch # User bsmith@81767d24-ef19-dc11-ae90-00e081727c95 # Date 1301896185 0 # Node ID b15ad609365e82f7ec68aa24ce5db47ee4f24431 # Parent 59c4fac42fb548761e843e79ec7a573cf4a72a42 Solaris recommends using statvfs() instead of statfs() diff -r 59c4fac42fb5 -r b15ad609365e compat.c --- a/compat.c Mon Apr 04 04:37:05 2011 +0000 +++ b/compat.c Mon Apr 04 05:49:45 2011 +0000 @@ -15,7 +15,7 @@ #include #include #include -#include +#include #else #include #include @@ -117,7 +117,7 @@ #elif defined(__sun__) FILE *fp = fopen("/etc/mnttab", "r"); struct mnttab mnt; - struct statfs sfs; + struct statvfs sfs; int index = 1; if(fp) @@ -130,9 +130,9 @@ if(mnt.mnt_mountp) { - if(!statfs(mnt.mnt_mountp, &sfs, sizeof(struct statfs), 0)) + if(!statvfs(mnt.mnt_mountp, &sfs)) { - size = (long double)((double)sfs.f_bsize * (double)sfs.f_bfree); + size = (long double)((double)sfs.f_bsize * (double)sfs.f_bavail); } } fclose(fp); @@ -219,7 +219,7 @@ #elif defined(__sun__) FILE *fp = fopen("/etc/mnttab", "r"); struct mnttab mnt; - struct statfs sfs; + struct statvfs sfs; int index = 1; if(fp) @@ -232,7 +232,7 @@ if(mnt.mnt_mountp) { - if(!statfs(mnt.mnt_mountp, &sfs, sizeof(struct statfs), 0)) + if(!statvfs(mnt.mnt_mountp, &sfs)) { size = (long double)((double)sfs.f_bsize * (double)sfs.f_blocks); } @@ -318,7 +318,7 @@ #elif defined(__sun__) FILE *fp = fopen("/etc/mnttab", "r"); struct mnttab mnt; - struct statfs sfs; + struct statvfs sfs; int index = 1; if(fp) @@ -330,7 +330,7 @@ fclose(fp); if(mnt.mnt_mountp) { - if(!statfs(mnt.mnt_mountp, &sfs, sizeof(struct statfs), 0) && sfs.f_blocks) + if(!statvfs(mnt.mnt_mountp, &sfs) && sfs.f_blocks) return 1; } return 0;