[Bf-blender-cvs] SVN commit: /data/svn/bf-blender [13414] trunk/blender/source/blender/ blenlib/intern/storage.c: solaris was crashing on file open because of statfs, aparently linux-standards-base and solaris have depricated statfs so probably all unix os 's should use statvfs.

Campbell Barton ideasman42 at gmail.com
Sat Jan 26 21:36:14 CET 2008


Revision: 13414
          http://projects.blender.org/plugins/scmsvn/viewcvs.php?view=rev&root=bf-blender&revision=13414
Author:   campbellbarton
Date:     2008-01-26 21:36:14 +0100 (Sat, 26 Jan 2008)

Log Message:
-----------
solaris was crashing on file open because of statfs, aparently linux-standards-base and solaris have depricated statfs so probably all unix os's should use statvfs. for now only solaris does.

Modified Paths:
--------------
    trunk/blender/source/blender/blenlib/intern/storage.c

Modified: trunk/blender/source/blender/blenlib/intern/storage.c
===================================================================
--- trunk/blender/source/blender/blenlib/intern/storage.c	2008-01-26 19:54:25 UTC (rev 13413)
+++ trunk/blender/source/blender/blenlib/intern/storage.c	2008-01-26 20:36:14 UTC (rev 13414)
@@ -50,7 +50,9 @@
 #include <time.h>
 #include <sys/stat.h>
 
-#if !defined(linux) && (defined(__sgi) || defined(__sun__) || defined(__sun) || defined(__sparc) || defined(__sparc__))
+#if defined (__sun__) || defined (__sun)
+#include <sys/statvfs.h> /* Other modern unix os's should probably use this also */
+#elif !defined(linux) && (defined(__sgi) || defined(__sparc) || defined(__sparc__))
 #include <sys/statfs.h>
 #endif
 
@@ -179,7 +181,12 @@
 
 	return (double) (freec*bytesps*sectorspc);
 #else
+
+#if defined (__sun__) || defined (__sun)
+	struct statvfs disk;
+#else
 	struct statfs disk;
+#endif
 	char name[FILE_MAXDIR],*slash;
 	int len = strlen(dir);
 	
@@ -199,12 +206,12 @@
 #ifdef __BeOS
 	return -1;
 #endif
-#if !defined(linux) && (defined (__sgi) || defined (__sun__) || defined (__sun) || defined(__sparc) || defined(__sparc__))
 
-	if (statfs(name, &disk, sizeof(struct statfs), 0)){
-		/* printf("diskfree: Couldn't get information about %s.\n",dir); */
-		return(-1);
-	}
+#if defined (__sun__) || defined (__sun)
+	if (statvfs(name, &disk)) return(-1);	
+#elif !defined(linux) && (defined (__sgi) || defined  || defined(__sparc) || defined(__sparc__))
+	/* WARNING - This may not be supported by geeneric unix os's - Campbell */
+	if (statfs(name, &disk, sizeof(struct statfs), 0)) return(-1);
 #endif
 
 	return ( ((double) disk.f_bsize) * ((double) disk.f_bfree));





More information about the Bf-blender-cvs mailing list