[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: boot-time: straighten code
From: |
Bruno Haible |
Subject: |
Re: boot-time: straighten code |
Date: |
Sun, 13 Aug 2023 16:36:47 +0200 |
Po Lu wrote:
> During the automated build of the Android port, the following errors
> were encountered with the Android NDK r10b and __ANDROID_API__ set to 8
> (which is the oldest configuration Emacs supports.)
> ...
> boot-time.c: In function 'get_boot_time_uncached':
> boot-time.c:111:26: error: 'BOOT_TIME' undeclared (first use in this function)
> if (ut->ut_type == BOOT_TIME)
> ^
Unlike USER_PROCESS, which is defined in all versions of Android's <utmp.h>,
BOOT_TIME is only defined in newer versions.
When compiling against an older version, we need to use the value from the
newer versions — otherwise a binary built against an older version might
not work right when running on a newer Android.
This patch does it.
2023-08-13 Bruno Haible <bruno@clisp.org>
readutmp, boot-time: Fix compilation error on old Android.
Reported by Po Lu in
<https://lists.gnu.org/archive/html/bug-gnulib/2023-08/msg00108.html>.
* lib/readutmp.h (BOOT_TIME): Add fallback.
diff --git a/lib/readutmp.h b/lib/readutmp.h
index 1cf588d265..f7cad36d44 100644
--- a/lib/readutmp.h
+++ b/lib/readutmp.h
@@ -249,6 +249,13 @@ struct utmpx32
# define WTMP_FILE "/etc/wtmp"
#endif
+/* In early versions of Android, <utmp.h> did not define BOOT_TIME, only
+ USER_PROCESS. We need to use the value that is defined in newer versions
+ of Android. */
+#if defined __ANDROID__ && !defined BOOT_TIME
+# define BOOT_TIME 2
+#endif
+
/* Some platforms, such as OpenBSD, don't have an ut_type field and don't have
the BOOT_TIME and USER_PROCESS macros. But we want to support them in
'struct gl_utmp'. */
- Re: boot-time: straighten code, Paul Eggert, 2023/08/12
- Re: boot-time: straighten code, Po Lu, 2023/08/12
- Re: boot-time: straighten code, Paul Eggert, 2023/08/13
- Re: boot-time: straighten code, Bruno Haible, 2023/08/13
- Re: boot-time: straighten code, Bruno Haible, 2023/08/13
- Re: boot-time: straighten code,
Bruno Haible <=
- Re: boot-time: straighten code, Po Lu, 2023/08/13
- Re: boot-time: straighten code, Bruno Haible, 2023/08/13
- Re: boot-time: straighten code, Po Lu, 2023/08/13
- Re: boot-time: straighten code, Corwin Brust, 2023/08/13
- Re: Windows port binaries, Bruno Haible, 2023/08/15
- Re: Windows port binaries, Po Lu, 2023/08/16
- Re: Windows port binaries, Eli Zaretskii, 2023/08/16
- Re: Windows port binaries, Bruno Haible, 2023/08/17
- Re: Windows port binaries, Eli Zaretskii, 2023/08/17
Re: boot-time: straighten code, Andreas Schwab, 2023/08/14