summaryrefslogtreecommitdiffstats
path: root/winsup/cygwin/times.cc
diff options
context:
space:
mode:
authorCorinna Vinschen <corinna@vinschen.de>2015-02-20 15:13:46 +0000
committerCorinna Vinschen <corinna@vinschen.de>2015-02-20 15:13:46 +0000
commitd6f62a117812f074bff9cbe11099b9f6406ab08a (patch)
tree9922732a892b7786c210c977d7a3bef100647ed9 /winsup/cygwin/times.cc
parent89a3749928a964ca31067efc7c3694a4bbbf1289 (diff)
downloadcygnal-d6f62a117812f074bff9cbe11099b9f6406ab08a.tar.gz
cygnal-d6f62a117812f074bff9cbe11099b9f6406ab08a.tar.bz2
cygnal-d6f62a117812f074bff9cbe11099b9f6406ab08a.zip
* grp.cc (internal_getgroups): Take additional timeout_ns parameter.
Restrict fetching group account entries from user token groups by timeout_ns 100ns-intervals. Add preceding comment to explain why. * pwdgrp.h (internal_getgroups): Align prototype. * times.cc (GetTickCount_ns): New function. * uinfo.cc (internal_getlogin): Call internal_getgroups wih 300ms timeout. * winsup.h (GetTickCount_ns): Declare.
Diffstat (limited to 'winsup/cygwin/times.cc')
-rw-r--r--winsup/cygwin/times.cc19
1 files changed, 18 insertions, 1 deletions
diff --git a/winsup/cygwin/times.cc b/winsup/cygwin/times.cc
index bd8f1cf0e..f0359bfeb 100644
--- a/winsup/cygwin/times.cc
+++ b/winsup/cygwin/times.cc
@@ -1,7 +1,7 @@
/* times.cc
Copyright 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006,
- 2007, 2008, 2009, 2010, 2011, 2012, 2013, 2014 Red Hat, Inc.
+ 2007, 2008, 2009, 2010, 2011, 2012, 2013, 2014, 2015 Red Hat, Inc.
This file is part of Cygwin.
@@ -42,6 +42,23 @@ get_system_time (PLARGE_INTEGER systime)
: GetSystemTimeAsFileTime ((LPFILETIME) systime);
}
+/* There's no GetTickCount64 on pre-Vista. This is the do-it-yourself kit,
+ as it was implemented as hires_ms::timeGetTime_ns once. Resurrect the
+ functionality to allow reliable (albeit low res) timing values. The
+ function returns the value in 100ns interval to avoid a division by 10000. */
+ULONGLONG
+GetTickCount_ns ()
+{
+ LARGE_INTEGER t;
+ do
+ {
+ t.HighPart = SharedUserData.InterruptTime.High1Time;
+ t.LowPart = SharedUserData.InterruptTime.LowPart;
+ }
+ while (t.HighPart != SharedUserData.InterruptTime.High2Time);
+ return (ULONGLONG) t.QuadPart;
+}
+
/* Cygwin internal */
static uint64_t __stdcall
__to_clock_t (PLARGE_INTEGER src, int flag)