[newlib-cygwin] Cygwin: wincap: split has_posix_file_info

Corinna Vinschen corinna@sourceware.org
Mon Jan 14 19:38:00 GMT 2019


https://sourceware.org/git/gitweb.cgi?p=newlib-cygwin.git;h=5275b3e3f20387716c4216905a57155ce63c4360

commit 5275b3e3f20387716c4216905a57155ce63c4360
Author: Corinna Vinschen <corinna@vinschen.de>
Date:   Mon Jan 14 20:38:24 2019 +0100

    Cygwin: wincap: split has_posix_file_info
    
    While FileRenameInformationEx is defined starting with Windows
    10 1709 per MSDN, it only starts working in W10 1809, apparently.
    Users of 1803 report "Function not implemented".
    
    Introduce wincap_10_1809 and change the version check in
    wincapc::init accordingly.  Split has_posix_file_info into
    has_posix_unlink_semantics and has_posix_rename_semantics.
    Enable the latter only starting with W10 1809.
    
    Signed-off-by: Corinna Vinschen <corinna@vinschen.de>

Diff:
---
 winsup/cygwin/syscalls.cc |  5 +++--
 winsup/cygwin/wincap.cc   | 51 ++++++++++++++++++++++++++++++++++++++---------
 winsup/cygwin/wincap.h    |  6 ++++--
 3 files changed, 49 insertions(+), 13 deletions(-)

diff --git a/winsup/cygwin/syscalls.cc b/winsup/cygwin/syscalls.cc
index 2628d94..04035a9 100644
--- a/winsup/cygwin/syscalls.cc
+++ b/winsup/cygwin/syscalls.cc
@@ -698,7 +698,8 @@ unlink_nt (path_conv &pc)
   /* First check if we can use POSIX unlink semantics: W10 1709++, local NTFS.
      With POSIX unlink semantics the entire job gets MUCH easier and faster.
      Just try to do it and if it fails, it fails. */
-  if (wincap.has_posix_file_info () && !pc.isremote () && pc.fs_is_ntfs ())
+  if (wincap.has_posix_unlink_semantics ()
+      && !pc.isremote () && pc.fs_is_ntfs ())
     {
       FILE_DISPOSITION_INFORMATION_EX fdie;
 
@@ -2520,7 +2521,7 @@ rename2 (const char *oldpath, const char *newpath, unsigned int at2flags)
 	}
 
       /* POSIX semantics only on local NTFS drives. */
-      use_posix_semantics = wincap.has_posix_file_info ()
+      use_posix_semantics = wincap.has_posix_rename_semantics ()
 			    && !oldpc.isremote ()
 			    && oldpc.fs_is_ntfs ();
 
diff --git a/winsup/cygwin/wincap.cc b/winsup/cygwin/wincap.cc
index d9aea8a..4c1c7b4 100644
--- a/winsup/cygwin/wincap.cc
+++ b/winsup/cygwin/wincap.cc
@@ -35,8 +35,9 @@ wincaps wincap_vista __attribute__((section (".cygwin_dll_common"), shared)) = {
     has_unprivileged_createsymlink:false,
     has_unbiased_interrupt_time:false,
     has_precise_interrupt_time:false,
-    has_posix_file_info:false,
+    has_posix_unlink_semantics:false,
     has_case_sensitive_dirs:false,
+    has_posix_rename_semantics:false,
   },
 };
 
@@ -57,8 +58,9 @@ wincaps wincap_7 __attribute__((section (".cygwin_dll_common"), shared)) = {
     has_unprivileged_createsymlink:false,
     has_unbiased_interrupt_time:true,
     has_precise_interrupt_time:false,
-    has_posix_file_info:false,
+    has_posix_unlink_semantics:false,
     has_case_sensitive_dirs:false,
+    has_posix_rename_semantics:false,
   },
 };
 
@@ -79,8 +81,9 @@ wincaps wincap_8 __attribute__((section (".cygwin_dll_common"), shared)) = {
     has_unprivileged_createsymlink:false,
     has_unbiased_interrupt_time:true,
     has_precise_interrupt_time:false,
-    has_posix_file_info:false,
+    has_posix_unlink_semantics:false,
     has_case_sensitive_dirs:false,
+    has_posix_rename_semantics:false,
   },
 };
 
@@ -101,8 +104,9 @@ wincaps  wincap_10_1507 __attribute__((section (".cygwin_dll_common"), shared))
     has_unprivileged_createsymlink:false,
     has_unbiased_interrupt_time:true,
     has_precise_interrupt_time:true,
-    has_posix_file_info:false,
+    has_posix_unlink_semantics:false,
     has_case_sensitive_dirs:false,
+    has_posix_rename_semantics:false,
   },
 };
 
@@ -123,8 +127,9 @@ wincaps wincap_10_1511 __attribute__((section (".cygwin_dll_common"), shared)) =
     has_unprivileged_createsymlink:false,
     has_unbiased_interrupt_time:true,
     has_precise_interrupt_time:true,
-    has_posix_file_info:false,
+    has_posix_unlink_semantics:false,
     has_case_sensitive_dirs:false,
+    has_posix_rename_semantics:false,
   },
 };
 
@@ -145,8 +150,9 @@ wincaps wincap_10_1703 __attribute__((section (".cygwin_dll_common"), shared)) =
     has_unprivileged_createsymlink:true,
     has_unbiased_interrupt_time:true,
     has_precise_interrupt_time:true,
-    has_posix_file_info:false,
+    has_posix_unlink_semantics:false,
     has_case_sensitive_dirs:false,
+    has_posix_rename_semantics:false,
   },
 };
 
@@ -167,8 +173,9 @@ wincaps wincap_10_1709 __attribute__((section (".cygwin_dll_common"), shared)) =
     has_unprivileged_createsymlink:true,
     has_unbiased_interrupt_time:true,
     has_precise_interrupt_time:true,
-    has_posix_file_info:true,
+    has_posix_unlink_semantics:true,
     has_case_sensitive_dirs:false,
+    has_posix_rename_semantics:false,
   },
 };
 
@@ -189,8 +196,32 @@ wincaps wincap_10_1803 __attribute__((section (".cygwin_dll_common"), shared)) =
     has_unprivileged_createsymlink:true,
     has_unbiased_interrupt_time:true,
     has_precise_interrupt_time:true,
-    has_posix_file_info:true,
+    has_posix_unlink_semantics:true,
     has_case_sensitive_dirs:true,
+    has_posix_rename_semantics:false,
+  },
+};
+
+wincaps wincap_10_1809 __attribute__((section (".cygwin_dll_common"), shared)) = {
+  def_guard_pages:2,
+  {
+    is_server:false,
+    needs_count_in_si_lpres2:false,
+    has_gaa_largeaddress_bug:false,
+    has_broken_alloc_console:true,
+    has_console_logon_sid:true,
+    has_precise_system_time:true,
+    has_microsoft_accounts:true,
+    has_processor_groups:true,
+    has_broken_prefetchvm:false,
+    has_new_pebteb_region:true,
+    has_broken_whoami:false,
+    has_unprivileged_createsymlink:true,
+    has_unbiased_interrupt_time:true,
+    has_precise_interrupt_time:true,
+    has_posix_unlink_semantics:true,
+    has_case_sensitive_dirs:true,
+    has_posix_rename_semantics:true,
   },
 };
 
@@ -234,7 +265,9 @@ wincapc::init ()
 	break;
       case 10:
       default:
-	if (likely (version.dwBuildNumber >= 17134))
+	if (likely (version.dwBuildNumber >= 17763))
+	  caps = &wincap_10_1809;
+	else if (version.dwBuildNumber >= 17134)
 	  caps = &wincap_10_1803;
 	else if (version.dwBuildNumber >= 16299)
 	  caps = &wincap_10_1709;
diff --git a/winsup/cygwin/wincap.h b/winsup/cygwin/wincap.h
index 967ddbd..d89fd71 100644
--- a/winsup/cygwin/wincap.h
+++ b/winsup/cygwin/wincap.h
@@ -29,8 +29,9 @@ struct wincaps
     unsigned has_unprivileged_createsymlink	: 1;
     unsigned has_unbiased_interrupt_time	: 1;
     unsigned has_precise_interrupt_time		: 1;
-    unsigned has_posix_file_info		: 1;
+    unsigned has_posix_unlink_semantics		: 1;
     unsigned has_case_sensitive_dirs		: 1;
+    unsigned has_posix_rename_semantics		: 1;
   };
 };
 
@@ -80,8 +81,9 @@ public:
   bool	IMPLEMENT (has_unprivileged_createsymlink)
   bool	IMPLEMENT (has_unbiased_interrupt_time)
   bool	IMPLEMENT (has_precise_interrupt_time)
-  bool	IMPLEMENT (has_posix_file_info)
+  bool	IMPLEMENT (has_posix_unlink_semantics)
   bool	IMPLEMENT (has_case_sensitive_dirs)
+  bool	IMPLEMENT (has_posix_rename_semantics)
 
   void disable_case_sensitive_dirs ()
   {



More information about the Cygwin-cvs mailing list