diff --git a/coreutils-nproc-affinity.patch b/coreutils-nproc-affinity.patch new file mode 100644 index 0000000..8c682d4 --- /dev/null +++ b/coreutils-nproc-affinity.patch @@ -0,0 +1,44 @@ +diff -ur coreutils-9.5.orig/lib/nproc.c coreutils-9.5/lib/nproc.c +--- coreutils-9.5.orig/lib/nproc.c 2024-01-01 14:21:47.000000000 +0100 ++++ coreutils-9.5/lib/nproc.c 2024-11-11 10:48:05.435716502 +0100 +@@ -20,6 +20,7 @@ + #include + #include "nproc.h" + ++#include + #include + #include + #include +@@ -124,6 +125,31 @@ + return count; + } + } ++#elif HAVE_SCHED_GETAFFINITY_LIKE_GLIBC \ ++ && defined CPU_COUNT /* glibc >= 2.3.4 */ ++ { ++ unsigned int alloc_count = 1024; ++ while (1) ++ { ++ cpu_set_t *set = CPU_ALLOC (alloc_count); ++ unsigned int size = CPU_ALLOC_SIZE (alloc_count); ++ if (sched_getaffinity (0, size, set) == 0) ++ { ++ unsigned int count = CPU_COUNT_S (size, set); ++ CPU_FREE (set); ++ return count; ++ } ++ if (errno != EINVAL) ++ { ++ CPU_FREE (set); ++ return 0; ++ } ++ CPU_FREE (set); ++ alloc_count *= 2; ++ if (alloc_count == 0) ++ return 0; ++ } ++ } + #elif HAVE_SCHED_GETAFFINITY_LIKE_GLIBC /* glibc >= 2.3.4 */ + { + cpu_set_t set; +Only in coreutils-9.5/lib: nproc.c~ diff --git a/coreutils.spec b/coreutils.spec index 744b454..71334b9 100644 --- a/coreutils.spec +++ b/coreutils.spec @@ -1,7 +1,7 @@ Summary: A set of basic GNU tools commonly used in shell scripts Name: coreutils Version: 9.5 -Release: 10%{?dist} +Release: 10%{?dist}.nproc.1 # some used parts of gnulib are under various variants of LGPL License: GPL-3.0-or-later AND GFDL-1.3-no-invariants-or-later AND LGPL-2.1-or-later AND LGPL-3.0-or-later Url: https://www.gnu.org/software/coreutils/ @@ -36,6 +36,8 @@ Patch104: coreutils-df-direct.patch # https://git.savannah.gnu.org/cgit/gnulib.git/patch/?id=43f7f428a1665950233557bd97611bd5e996b5cb Patch105: coreutils-9.5-readutmp-web-session.patch +Patch106: coreutils-nproc-affinity.patch + # (sb) lin18nux/lsb compliance - multibyte functionality patch Patch800: coreutils-i18n.patch