[newlib-cygwin] Cygwin: drop support for systems not supporting QueryUnbiasedInterruptTime

Corinna Vinschen corinna@sourceware.org
Fri Oct 29 19:03:27 GMT 2021


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

commit e8bfe362814ea5e6837cb94656fbc54a743ca940
Author: Corinna Vinschen <corinna@vinschen.de>
Date:   Fri Oct 29 18:01:33 2021 +0200

    Cygwin: drop support for systems not supporting QueryUnbiasedInterruptTime
    
    i. e., Vista/2008
    
    Signed-off-by: Corinna Vinschen <corinna@vinschen.de>

Diff:
---
 winsup/cygwin/clock.cc  | 25 ++++++-------------------
 winsup/cygwin/wincap.cc | 11 -----------
 winsup/cygwin/wincap.h  |  2 --
 3 files changed, 6 insertions(+), 32 deletions(-)

diff --git a/winsup/cygwin/clock.cc b/winsup/cygwin/clock.cc
index 9c0b787ba..e010ed488 100644
--- a/winsup/cygwin/clock.cc
+++ b/winsup/cygwin/clock.cc
@@ -190,26 +190,13 @@ clk_monotonic_t::now (clockid_t clockid, struct timespec *ts)
 int
 clk_monotonic_coarse_t::now (clockid_t clockid, struct timespec *ts)
 {
-  if (wincap.has_unbiased_interrupt_time ())
-    {
-      /* Suspend time not taken into account, as on Linux */
-      ULONGLONG now;
-
-      QueryUnbiasedInterruptTime (&now);
-      ts->tv_sec = now / NS100PERSEC;
-      now %= NS100PERSEC;
-      ts->tv_nsec = now * (NSPERSEC/NS100PERSEC);
-    }
-  else
-    {
-      /* Vista-only: GetTickCount64 is biased but it's coarse and monotonic. */
-      ULONGLONG now;
+  /* Suspend time not taken into account, as on Linux */
+  ULONGLONG now;
 
-      now = GetTickCount64 ();	/* Returns ms since boot */
-      ts->tv_sec = now / MSPERSEC;
-      now %= MSPERSEC;
-      ts->tv_nsec = now * (NSPERSEC/MSPERSEC);
-    }
+  QueryUnbiasedInterruptTime (&now);
+  ts->tv_sec = now / NS100PERSEC;
+  now %= NS100PERSEC;
+  ts->tv_nsec = now * (NSPERSEC/NS100PERSEC);
   return 0;
 }
 
diff --git a/winsup/cygwin/wincap.cc b/winsup/cygwin/wincap.cc
index dbf36272b..b94f38e31 100644
--- a/winsup/cygwin/wincap.cc
+++ b/winsup/cygwin/wincap.cc
@@ -34,7 +34,6 @@ wincaps wincap_vista __attribute__((section (".cygwin_dll_common"), shared)) = {
     has_new_pebteb_region:false,
     has_broken_whoami:true,
     has_unprivileged_createsymlink:false,
-    has_unbiased_interrupt_time:false,
     has_precise_interrupt_time:false,
     has_posix_unlink_semantics:false,
     has_posix_unlink_semantics_with_ignore_readonly:false,
@@ -69,7 +68,6 @@ wincaps wincap_7 __attribute__((section (".cygwin_dll_common"), shared)) = {
     has_new_pebteb_region:false,
     has_broken_whoami:true,
     has_unprivileged_createsymlink:false,
-    has_unbiased_interrupt_time:true,
     has_precise_interrupt_time:false,
     has_posix_unlink_semantics:false,
     has_posix_unlink_semantics_with_ignore_readonly:false,
@@ -104,7 +102,6 @@ wincaps wincap_8 __attribute__((section (".cygwin_dll_common"), shared)) = {
     has_new_pebteb_region:false,
     has_broken_whoami:false,
     has_unprivileged_createsymlink:false,
-    has_unbiased_interrupt_time:true,
     has_precise_interrupt_time:false,
     has_posix_unlink_semantics:false,
     has_posix_unlink_semantics_with_ignore_readonly:false,
@@ -139,7 +136,6 @@ wincaps wincap_8_1 __attribute__((section (".cygwin_dll_common"), shared)) = {
     has_new_pebteb_region:false,
     has_broken_whoami:false,
     has_unprivileged_createsymlink:false,
-    has_unbiased_interrupt_time:true,
     has_precise_interrupt_time:false,
     has_posix_unlink_semantics:false,
     has_posix_unlink_semantics_with_ignore_readonly:false,
@@ -174,7 +170,6 @@ wincaps  wincap_10_1507 __attribute__((section (".cygwin_dll_common"), shared))
     has_new_pebteb_region:false,
     has_broken_whoami:false,
     has_unprivileged_createsymlink:false,
-    has_unbiased_interrupt_time:true,
     has_precise_interrupt_time:true,
     has_posix_unlink_semantics:false,
     has_posix_unlink_semantics_with_ignore_readonly:false,
@@ -209,7 +204,6 @@ wincaps  wincap_10_1607 __attribute__((section (".cygwin_dll_common"), shared))
     has_new_pebteb_region:false,
     has_broken_whoami:false,
     has_unprivileged_createsymlink:false,
-    has_unbiased_interrupt_time:true,
     has_precise_interrupt_time:true,
     has_posix_unlink_semantics:false,
     has_posix_unlink_semantics_with_ignore_readonly:false,
@@ -244,7 +238,6 @@ wincaps wincap_10_1703 __attribute__((section (".cygwin_dll_common"), shared)) =
     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:false,
     has_posix_unlink_semantics_with_ignore_readonly:false,
@@ -279,7 +272,6 @@ wincaps wincap_10_1709 __attribute__((section (".cygwin_dll_common"), shared)) =
     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_posix_unlink_semantics_with_ignore_readonly:false,
@@ -314,7 +306,6 @@ wincaps wincap_10_1803 __attribute__((section (".cygwin_dll_common"), shared)) =
     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_posix_unlink_semantics_with_ignore_readonly:false,
@@ -349,7 +340,6 @@ wincaps wincap_10_1809 __attribute__((section (".cygwin_dll_common"), shared)) =
     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_posix_unlink_semantics_with_ignore_readonly:true,
@@ -384,7 +374,6 @@ wincaps wincap_10_1903 __attribute__((section (".cygwin_dll_common"), shared)) =
     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_posix_unlink_semantics_with_ignore_readonly:true,
diff --git a/winsup/cygwin/wincap.h b/winsup/cygwin/wincap.h
index 150ad253b..5b81af562 100644
--- a/winsup/cygwin/wincap.h
+++ b/winsup/cygwin/wincap.h
@@ -28,7 +28,6 @@ struct wincaps
     unsigned has_new_pebteb_region				: 1;
     unsigned has_broken_whoami					: 1;
     unsigned has_unprivileged_createsymlink			: 1;
-    unsigned has_unbiased_interrupt_time			: 1;
     unsigned has_precise_interrupt_time				: 1;
     unsigned has_posix_unlink_semantics				: 1;
     unsigned has_posix_unlink_semantics_with_ignore_readonly	: 1;
@@ -95,7 +94,6 @@ public:
   bool	IMPLEMENT (has_new_pebteb_region)
   bool	IMPLEMENT (has_broken_whoami)
   bool	IMPLEMENT (has_unprivileged_createsymlink)
-  bool	IMPLEMENT (has_unbiased_interrupt_time)
   bool	IMPLEMENT (has_precise_interrupt_time)
   bool	IMPLEMENT (has_posix_unlink_semantics)
   bool	IMPLEMENT (has_posix_unlink_semantics_with_ignore_readonly)


More information about the Cygwin-cvs mailing list