aboutsummaryrefslogtreecommitdiff
path: root/winsup
diff options
context:
space:
mode:
authorBrian Inglis <Brian.Inglis@SystematicSW.ab.ca>2019-03-23 20:22:38 -0600
committerCorinna Vinschen <corinna@vinschen.de>2019-03-25 11:26:17 +0100
commitee1ad64234b61f9deaae64b28313492188c1de43 (patch)
tree664cb09487505685052951c05a273beb5a902633 /winsup
parent5737045c00db0cf9462b556bf56fbfa15c9ba90c (diff)
downloadnewlib-ee1ad64234b61f9deaae64b28313492188c1de43.zip
newlib-ee1ad64234b61f9deaae64b28313492188c1de43.tar.gz
newlib-ee1ad64234b61f9deaae64b28313492188c1de43.tar.bz2
default ps -W process start time to system boot time when inaccessible, 0, -1
Diffstat (limited to 'winsup')
-rw-r--r--winsup/utils/ps.cc11
1 files changed, 11 insertions, 0 deletions
diff --git a/winsup/utils/ps.cc b/winsup/utils/ps.cc
index 4fce3e0..c81805a 100644
--- a/winsup/utils/ps.cc
+++ b/winsup/utils/ps.cc
@@ -337,6 +337,17 @@ main (int argc, char *argv[])
p->start_time = to_time_t (&ct);
CloseHandle (h);
}
+ if (!h || 0 == p->start_time || -1 == p->start_time)
+ {
+ SYSTEM_TIMEOFDAY_INFORMATION stodi;
+ status = NtQuerySystemInformation (SystemTimeOfDayInformation,
+ (PVOID) &stodi, sizeof stodi, NULL);
+ if (!NT_SUCCESS (status))
+ fprintf (stderr,
+ "NtQuerySystemInformation(SystemTimeOfDayInformation), "
+ "status %08x", status);
+ p->start_time = to_time_t ((FILETIME*)&stodi.BootTime);
+ }
}
char uname[128];