aboutsummaryrefslogtreecommitdiff
path: root/procps/ps.c
diff options
context:
space:
mode:
authorRon Yorston <rmy@pobox.com>2021-02-19 08:42:38 +0000
committerRon Yorston <rmy@pobox.com>2021-02-19 08:42:38 +0000
commitb4fcd6e378f30ffa36a87617d4c9e6113f70308d (patch)
treefeee88334cdea39e504180ab9bfb34147515a2ec /procps/ps.c
parent2b8770720868c750ad8609df4041337eb2c6cf71 (diff)
downloadbusybox-w32-b4fcd6e378f30ffa36a87617d4c9e6113f70308d.tar.gz
busybox-w32-b4fcd6e378f30ffa36a87617d4c9e6113f70308d.tar.bz2
busybox-w32-b4fcd6e378f30ffa36a87617d4c9e6113f70308d.zip
win32: add uptime to sysinfo(2), enable uptime applet
Fill the uptime member of the sysinfo structure. With this change we can: - use sysinfo(2) in the 'ps' applet; - enable the 'uptime' applet (though without useful support for load averages).
Diffstat (limited to 'procps/ps.c')
-rw-r--r--procps/ps.c4
1 files changed, 1 insertions, 3 deletions
diff --git a/procps/ps.c b/procps/ps.c
index f84060447..801a6fdf3 100644
--- a/procps/ps.c
+++ b/procps/ps.c
@@ -120,13 +120,11 @@ enum { MAX_WIDTH = 2*1024 };
120#if ENABLE_FEATURE_PS_TIME || ENABLE_FEATURE_PS_LONG 120#if ENABLE_FEATURE_PS_TIME || ENABLE_FEATURE_PS_LONG
121static unsigned long get_uptime(void) 121static unsigned long get_uptime(void)
122{ 122{
123#ifdef __linux__ 123#if defined __linux__ || ENABLE_PLATFORM_MINGW32
124 struct sysinfo info; 124 struct sysinfo info;
125 if (sysinfo(&info) < 0) 125 if (sysinfo(&info) < 0)
126 return 0; 126 return 0;
127 return info.uptime; 127 return info.uptime;
128#elif ENABLE_PLATFORM_MINGW32
129 return GetTickCount64()/1000;
130#elif 1 128#elif 1
131 unsigned long uptime; 129 unsigned long uptime;
132 char buf[sizeof(uptime)*3 + 2]; 130 char buf[sizeof(uptime)*3 + 2];