+2025-11-04 Collin Funk <collin.funk1@gmail.com>
+
+ nproc: Fix compilation error with Android API ≤ 20.
+ Reported by Po Lu in
+ <https://lists.gnu.org/archive/html/bug-gnulib/2025-11/msg00027.html>.
+ * lib/nproc.c (cgroup2_mount): Don't assume we have setmntent if we have
+ mntent.h.
+ * m4/nproc.m4 (gl_PREREQ_NPROC): Check if setmntent is supported by the
+ current Android API.
+
2025-11-04 Paul Eggert <eggert@cs.ucla.edu>
time_rz: tzfree now preserves errno
#include <errno.h>
#include <limits.h>
-#if HAVE_MNTENT_H
+#if HAVE_SETMNTENT
# include <mntent.h>
#endif
#include <stdlib.h>
if (access ("/sys/fs/cgroup/cgroup.controllers", F_OK) == 0)
return strdup ("/sys/fs/cgroup");
-#if HAVE_MNTENT_H
+#if HAVE_SETMNTENT
/* Otherwise look for the mount point. */
struct mntent *mnt;
if (! (fp = setmntent ("/proc/mounts", "r")))
# nproc.m4
-# serial 7
+# serial 8
dnl Copyright (C) 2009-2025 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_HEADERS([mntent.h sys/pstat.h sys/param.h],,,
[AC_INCLUDES_DEFAULT])
+ gl_CHECK_FUNCS_ANDROID([setmntent],
+ [[#include <stdio.h>
+ #include <mntent.h>
+ ]])
dnl <sys/sysctl.h> requires <sys/param.h> on OpenBSD 4.0.
AC_CHECK_HEADERS([sys/sysctl.h],,,
[AC_INCLUDES_DEFAULT