boot-time: straighten code

2023-08-11 Thread Bruno Haible
This set of patches straightens the code of the 'boot-time' module: Determining the boot time does require iterating through the /var/run/utmpx file, but it does not require - memory allocation, - copying of strings, - evaluating an options parameter, - linking with libsystemd. So, let me

readutmp tests: Fix link error

2023-08-11 Thread Bruno Haible
On OpenBSD 7.2, with GNU gettext installed, in a coreutils build, I see this link error: CCLD test-readutmp ld: error: undefined symbol: libintl_gettext >>> referenced by xalloc-die.c:34 (../lib/xalloc-die.c:34) >>> libcoreutils_a-xalloc-die.o:(xalloc_die) in archive >>> ../li

readutmp: Fix the boot time returned on Minix

2023-08-11 Thread Bruno Haible
On Minix 3.3, the boot time returned by read_utmp is 1970-01-01 00:00:00. Two workarounds are possible: - Take the time of the "system down" or "run-level m" entry instead, like the workaround for Raspbian does. - Use the time stamp of the file /var/run/syslogd.pid, like the workarounds

readutmp: On Cygwin and Windows, return the boot time

2023-08-11 Thread Bruno Haible
Windows has no utmp file. But it's possible to derive the boot time by looking at the time stamp of a file, namely C:\pagefile.sys. This is the same trick as used by Emacs (see emacs/nt/inc/ms-w32.h:BOOT_TIME_FILE). Other ways to determine the boot time, through the event log, would also be possib

clock-time: On mingw, avoid buggy clock_gettime from libwinpthread

2023-08-11 Thread Bruno Haible
On 32-bit mingw (both mingw 5.0.3 and mingw 10.0.0), I see these test failures: FAIL: test-timespec_get === ../../gltests/test-timespec_get.c:52: assertion 'ts1.tv_sec <= tt2' failed FAIL test-timespec_get.exe (exit status: 3) FAIL: test-timespec_getres ==

Re: boot time on Linux

2023-08-11 Thread Po Lu
Bruno Haible writes: > Po Lu wrote: >> >> Both clock_gettime (CLOCK_BOOTIME, ... sysinfo fail with AVC denial >> >> errors and errno set to EACCESS. >> > >> > Was this inside Termux, or inside the Emacs app? >> >> Inside the Emacs app. > > Emacs does not have the following in AndroidManifest.xml