summaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
authorPo Lu <luangruo@yahoo.com>2023-08-14 09:15:51 +0800
committerPo Lu <luangruo@yahoo.com>2023-08-14 09:15:51 +0800
commit0e390f54fa61a5a8c9481a862803d0de78815d6a (patch)
treedbce229eb26813abbb4f1004b5aeaddd5a757ae4 /lib
parent6412ba2f1ad93bf641b86ba7633beb4f6dda89ea (diff)
downloademacs-0e390f54fa61a5a8c9481a862803d0de78815d6a.tar.gz
; Update from Gnulib
* lib/boot-time-aux.h (get_linux_uptime): * lib/boot-time.c (UT_USER): * lib/nproc.c (num_processors_ignoring_omp): * lib/readutmp.h (WTMP_FILE): * m4/readutmp.m4 (gl_READUTMP): * m4/stdint.m4: Update from Gnulib.
Diffstat (limited to 'lib')
-rw-r--r--lib/boot-time-aux.h2
-rw-r--r--lib/boot-time.c8
-rw-r--r--lib/nproc.c4
-rw-r--r--lib/readutmp.h7
4 files changed, 16 insertions, 5 deletions
diff --git a/lib/boot-time-aux.h b/lib/boot-time-aux.h
index 348611fc85c..e59a0fd03c7 100644
--- a/lib/boot-time-aux.h
+++ b/lib/boot-time-aux.h
@@ -65,6 +65,7 @@ get_linux_uptime (struct timespec *p_uptime)
}
# 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)
@@ -73,6 +74,7 @@ get_linux_uptime (struct timespec *p_uptime)
p_uptime->tv_nsec = 0;
return 0;
}
+# endif
return -1;
}
diff --git a/lib/boot-time.c b/lib/boot-time.c
index d813bfa5825..fe5b5b88c8e 100644
--- a/lib/boot-time.c
+++ b/lib/boot-time.c
@@ -32,7 +32,7 @@
# include <time.h>
#endif
-#if HAVE_SYS_SYSCTL_H && !defined __minix
+#if HAVE_SYS_SYSCTL_H && !(defined __GLIBC__ && defined __linux__) && !defined __minix
# if HAVE_SYS_PARAM_H
# include <sys/param.h>
# endif
@@ -65,8 +65,10 @@
# define UT_USER(UT) ((UT)->ut_user)
#endif
-#if !HAVE_UTMPX_H && HAVE_UTMP_H && defined UTMP_NAME_FUNCTION && !HAVE_DECL_GETUTENT
-struct utmp *getutent (void);
+#if !HAVE_UTMPX_H && HAVE_UTMP_H && defined UTMP_NAME_FUNCTION
+# if !HAVE_DECL_ENDUTENT /* Android */
+void endutent (void);
+# endif
#endif
#if defined __linux__ || HAVE_UTMPX_H || HAVE_UTMP_H || defined __CYGWIN__ || defined _WIN32
diff --git a/lib/nproc.c b/lib/nproc.c
index 2740c458c11..e3de1873a96 100644
--- a/lib/nproc.c
+++ b/lib/nproc.c
@@ -46,7 +46,7 @@
# include <sys/param.h>
#endif
-#if HAVE_SYS_SYSCTL_H && ! defined __GLIBC__
+#if HAVE_SYS_SYSCTL_H && !(defined __GLIBC__ && defined __linux__)
# include <sys/sysctl.h>
#endif
@@ -306,7 +306,7 @@ num_processors_ignoring_omp (enum nproc_query query)
/* Finally, as fallback, use the APIs that don't distinguish between
NPROC_CURRENT and NPROC_ALL. */
-#if HAVE_SYSCTL && ! defined __GLIBC__ && defined HW_NCPU
+#if HAVE_SYSCTL && !(defined __GLIBC__ && defined __linux__) && defined HW_NCPU
{ /* This works on macOS, FreeBSD, NetBSD, OpenBSD.
macOS 10.14 does not allow mib to be const. */
int nprocs;
diff --git a/lib/readutmp.h b/lib/readutmp.h
index 1cf588d265b..f7cad36d445 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'. */