]> Savannah Git Hosting - gnulib.git/commit
readutmp: Refactor boot time determination code.
authorBruno Haible <bruno@clisp.org>
Fri, 11 Aug 2023 21:20:44 +0000 (23:20 +0200)
committerBruno Haible <bruno@clisp.org>
Fri, 11 Aug 2023 21:20:44 +0000 (23:20 +0200)
commit1657e67fe3f4be3cd572430358991bc12c62b193
tree17a0228681b79d5d4c90ed23b75a3c3e65be6609
parentcdbe33c428a82d42ff6fdcb48815edeb9d9d7fd8
readutmp: Refactor boot time determination code.

* lib/boot-time-aux.h: New file, extracted from lib/readutmp.c.
* lib/readutmp.c: On Linux, include <sys/sysinfo.h> even if
!READUTMP_USE_SYSTEMD.
Include boot-time-aux.h.
(SIZEOF): Remove macro, moved to boot-time-aux.h.
(get_linux_uptime): Remove function, moved to boot-time-aux.h.
(read_utmp_from_file): Invoke get_linux_boot_time_fallback,
get_android_boot_time, get_openbsd_boot_time, get_windows_boot_time.
Code moved to boot-time-aux.h.
(get_boot_time_uncached: Invoke get_linux_boot_time_final_fallback.
Code moved to boot-time-aux.h.
* m4/readutmp.m4 (gl_PREREQ_READUTMP_H): New macro, extracted from
gl_READUTMP.
(gl_READUTMP): Invoke it.
* modules/readutmp (Files): Add lib/boot-time-aux.h.
ChangeLog
lib/boot-time-aux.h [new file with mode: 0644]
lib/readutmp.c
m4/readutmp.m4
modules/readutmp