]> sourceware.org Git - newlib-cygwin.git/commitdiff
* syscalls.cc: Include winioctl.h.
authorCorinna Vinschen <corinna@vinschen.de>
Wed, 8 Mar 2006 16:07:28 +0000 (16:07 +0000)
committerCorinna Vinschen <corinna@vinschen.de>
Wed, 8 Mar 2006 16:07:28 +0000 (16:07 +0000)
(statvfs): Request correct volume size using DeviceIoControl if
quotas are enforced on the file system.

winsup/cygwin/ChangeLog
winsup/cygwin/syscalls.cc

index 45ca8de43da5b0d40563b252ea66bd47bc4aa59c..a817b2da98cfe48c1571cc44e152aa94eb6dc503 100644 (file)
@@ -1,3 +1,16 @@
+2006-03-08  Corinna Vinschen  <corinna@vinschen.de>
+
+       * syscalls.cc: Include winioctl.h.
+       (statvfs): Request correct volume size using DeviceIoControl if
+       quotas are enforced on the file system.
+
+2006-03-06  Corinna Vinschen  <corinna@vinschen.de>
+
+       * dcrt0.cc (_dll_crt0): Revert to initialize *main_environ to NULL for
+       non-forked processes to circumvent problems with applications which
+       are messing around with the global variable "environ" in some
+       arbitrary way.
+
 2006-03-03  Corinna Vinschen  <corinna@vinschen.de>
 
        * dir.cc (opendir): Fix indentation.
index 33eef64d32e2b3875a81e14e8a5e9eda0f7471f4..0538ffa8a38a846d589e9cadfde02abbfbcf67d7 100644 (file)
@@ -42,6 +42,7 @@ details. */
 #include <setjmp.h>
 #include <winnls.h>
 #include <wininet.h>
+#include <winioctl.h>
 #include <lmcons.h> /* for UNLEN */
 #include <rpc.h>
 
@@ -1841,6 +1842,27 @@ statvfs (const char *fname, struct statvfs *sfs)
          availc = availb.QuadPart / (spc*bps);
          totalc = totalb.QuadPart / (spc*bps);
          freec = freeb.QuadPart / (spc*bps);
+         if (freec > availc)
+           {
+             /* Quotas active.  We can't trust totalc. */
+             HANDLE hdl = CreateFile (full_path.get_win32 (), READ_CONTROL,
+                                      wincap.shared (), &sec_none_nih,
+                                      OPEN_EXISTING,
+                                      FILE_FLAG_BACKUP_SEMANTICS, NULL);
+             if (hdl == INVALID_HANDLE_VALUE)
+               debug_printf ("CreateFile (%s) failed, %E", full_path.get_win32 ());
+             else
+               {
+                 NTFS_VOLUME_DATA_BUFFER nvdb;
+                 DWORD bytes;
+                 if (!DeviceIoControl (hdl, FSCTL_GET_NTFS_VOLUME_DATA, NULL,
+                                       0, &nvdb, sizeof nvdb, &bytes, NULL))
+                   debug_printf ("DeviceIoControl (%s) failed, %E", full_path.get_win32 ());
+                 else
+                   totalc = nvdb.TotalClusters.QuadPart;
+                 CloseHandle (hdl);
+               }
+           }
        }
       else
        availc = freec;
This page took 0.037411 seconds and 5 git commands to generate.