Index: modules/posixmodule.c =================================================================== RCS file: /cvsroot/python/python/dist/src/Modules/posixmodule.c,v retrieving revision 2.185 diff -u -r2.185 posixmodule.c --- modules/posixmodule.c 2001/02/27 17:04:34 2.185 +++ modules/posixmodule.c 2001/03/22 16:57:11 @@ -83,6 +83,7 @@ #define HAVE_PIPE 1 #define HAVE_POPEN 1 #define HAVE_SYSTEM 1 +#define HAVE_STATVFS 1 #else /* 16-bit Windows */ #endif /* !MS_WIN32 */ #else /* all other compilers */ @@ -4051,18 +4052,49 @@ #if defined(HAVE_STATVFS) +#if !defined(MS_WIN32) #include +#endif static char posix_statvfs__doc__[] = "statvfs(path) -> \n\ (bsize, frsize, blocks, bfree, bavail, files, ffree, favail, flag, namemax)\n\ Perform a statvfs system call on the given path."; +#if defined(MS_WIN32) static PyObject * posix_statvfs(PyObject *self, PyObject *args) { char *path; + DWORD csize, ssize, bfree, blocks; + long frsize; int res; + if (!PyArg_ParseTuple(args, "s:statvfs", &path)) + return NULL; + Py_BEGIN_ALLOW_THREADS + res = GetDiskFreeSpace(path, &csize, &ssize, &bfree, &blocks); + Py_END_ALLOW_THREADS + if (!res) + return win32_error("GetDiskFreeSpace", path); + frsize = csize * ssize; + return Py_BuildValue("(llllllllll)", + (long) frsize, + (long) frsize, + (long) blocks, + (long) bfree, + (long) bfree, + (long) 0, /* XXX: use None instead? */ + (long) 0, /* XXX: use None instead? */ + (long) 0, /* XXX: use None instead? */ + (long) 0, /* XXX: use None instead? */ + (long) MAXPATHLEN); +} +#else +static PyObject * +posix_statvfs(PyObject *self, PyObject *args) +{ + char *path; + int res; struct statvfs st; if (!PyArg_ParseTuple(args, "s:statvfs", &path)) return NULL; @@ -4097,6 +4129,7 @@ (long) st.f_namemax); #endif } +#endif /* MS_WIN32 */ #endif /* HAVE_STATVFS */