use statvfs() if statfs() is not available (Solaris)

git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@12096 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
Vadim Zeitlin
2001-10-19 19:03:52 +00:00
parent 8461e4c253
commit 9952adac06
4 changed files with 236 additions and 916 deletions

View File

@@ -37,6 +37,12 @@
# endif
#endif // HAVE_STATFS
#ifdef HAVE_STATVFS
#include <sys/statvfs.h>
#define statfs statvfs
#endif // HAVE_STATVFS
#if wxUSE_GUI
#include "wx/unix/execute.h"
#endif
@@ -1008,8 +1014,7 @@ long wxGetFreeMemory()
#ifndef __WXMAC__
bool wxGetDiskSpace(const wxString& path, wxLongLong *pTotal, wxLongLong *pFree)
{
#ifdef HAVE_STATFS
#if defined(HAVE_STATFS) || defined(HAVE_STATVFS)
struct statfs fs;
if ( statfs(path, &fs) != 0 )
{
@@ -1018,6 +1023,9 @@ bool wxGetDiskSpace(const wxString& path, wxLongLong *pTotal, wxLongLong *pFree)
return FALSE;
}
// under Solaris we might have to use fs.f_frsize instead as I think it
// may be a multiple of the block size in general (TODO)
if ( pTotal )
{
*pTotal = wxLongLong(fs.f_blocks) * fs.f_bsize;