On 19/08/2025 01:57, Collin Funk wrote:
Pádraig Brady <[email protected]> writes:
V2 attached with comments.
Thanks! That makes things easier to understand.
I did some similar testing to you, and everything seems to work as
expected:
$ podman run --rm -it --cpus=8 localhost/coreutils-env:latest
$ cat /sys/fs/cgroup/cpu.max
800000 100000
./src/nproc
8
$ docker run --rm -it --cpus=8 coreutils-env:latest
$ cat /sys/fs/cgroup/cpu.max
800000 100000
$ ./src/nproc
8
I assume you have a NEWS entry ready for Coreutils. This is a nice
change that deserves a mention, in my opinion. Thanks for working on it.
Yes I'll definitely add a NEWS entry to coreutils.
One very minor thing to add to Bruno's points:
#include <limits.h>
+#if HAVE_MNTENT_H
+# include <mntent.h>
+#endif
Since you added a dependency on the 'mntent-h' the header can always be
included. I would just remove the "#if HAVE_MNTENT_H". Having less of
those to worry about is always nice.
Well modules/mntent-h documents I need the HAVE_MNTENT_H
and looking at the m4 confirms the replacement is only conditional.
So really the module is not appropriate for nproc's usage.
Instead I've updated to not depend on mntent-h and
just add mntent.h to the list of headers to check in nproc.m4
thanks for testing!
Padraig