summaryrefslogtreecommitdiff
path: root/src/uptime.c
diff options
context:
space:
mode:
authorPaul Eggert <eggert@cs.ucla.edu>2004-11-30 21:40:29 +0000
committerPaul Eggert <eggert@cs.ucla.edu>2004-11-30 21:40:29 +0000
commit78a436fb0b497d613309a4cf7a61098dbfa072cc (patch)
tree6f96a4451945304cb3c1dc0b79a13ec009c4a993 /src/uptime.c
parent76d1b4a434ac7a84a0cb5b552205abe8ea8e41f7 (diff)
downloadcoreutils-78a436fb0b497d613309a4cf7a61098dbfa072cc.tar.xz
(print_uptime): Use IS_USER_PROCESS and
UT_TYPE_BOOT_TIME instead of by-hand code.
Diffstat (limited to 'src/uptime.c')
-rw-r--r--src/uptime.c20
1 files changed, 3 insertions, 17 deletions
diff --git a/src/uptime.c b/src/uptime.c
index 9552a9be6..9516f0f20 100644
--- a/src/uptime.c
+++ b/src/uptime.c
@@ -95,23 +95,9 @@ print_uptime (size_t n, const STRUCT_UTMP *this)
ones, also in the process possibly gleaning boottime. */
while (n--)
{
- if (UT_USER (this) [0]
-#ifdef USER_PROCESS
- && this->ut_type == USER_PROCESS
-#endif
- )
- {
- ++entries;
- }
- /* If BOOT_MSG is defined, we can get boottime from utmp. This avoids
- possibly needing special privs to read /dev/kmem. */
-#ifdef BOOT_MSG
-# if HAVE_PROC_UPTIME
- if (uptime == 0)
-# endif /* HAVE_PROC_UPTIME */
- if (strncmp (this->ut_line, BOOT_MSG, sizeof this->ut_line) == 0)
- boot_time = UT_TIME_MEMBER (this);
-#endif /* BOOT_MSG */
+ entries += IS_USER_PROCESS (this);
+ if (UT_TYPE_BOOT_TIME (this))
+ boot_time = UT_TIME_MEMBER (this);
++this;
}
time_now = time (0);