+2023-08-13 Bruno Haible <bruno@clisp.org>
+
+ readutmp, boot-time: Fix compilation error on Android API 8.
+ Reported by Po Lu in
+ <https://lists.gnu.org/archive/html/bug-gnulib/2023-08/msg00108.html>.
+ * m4/readutmp.m4 (gl_PREREQ_READUTMP_H): Test whether sysinfo is
+ declared.
+ * lib/boot-time-aux.h (get_linux_uptime): Invoke sysinfo only if it is
+ declared.
+ * doc/glibc-functions/sysinfo.texi: Mention the Android problem.
+
2023-08-13 Bruno Haible <bruno@clisp.org>
readutmp, boot-time: Fix compilation error on old Android.
@item
This function is missing on some platforms:
macOS 11.1, FreeBSD 13.0, NetBSD 9.0, OpenBSD 6.7, Minix 3.1.8, AIX 5.1, Cygwin 1.7.9, mingw, MSVC 14.
+@item
+This function is not declared and thus not part of the Android API
+for Android API levels < 9.
@end itemize
}
# endif
+# if HAVE_DECL_SYSINFO /* not available in Android API < 9 */
/* The sysinfo call returns the uptime with a resolution of 1 sec only. */
struct sysinfo info;
if (sysinfo (&info) >= 0)
p_uptime->tv_nsec = 0;
return 0;
}
+# endif
return -1;
}
-# readutmp.m4 serial 29
+# readutmp.m4 serial 30
dnl Copyright (C) 2002-2023 Free Software Foundation, Inc.
dnl This file is free software; the Free Software Foundation
dnl gives unlimited permission to copy and/or distribute it,
AC_CHECK_MEMBERS([struct utmp.ut_exit.e_termination],,,[$utmp_includes])
fi
+ AC_CHECK_DECLS([sysinfo],,,[[
+ #include <sys/sysinfo.h>
+ ]])
+
AC_CHECK_HEADERS_ONCE([sys/param.h])
dnl <sys/sysctl.h> requires <sys/param.h> on OpenBSD 4.0.
AC_CHECK_HEADERS([sys/sysctl.h],,,