From 538b50cb0a4aac56b6b3b6e4d1e8ce886854c6d8 Mon Sep 17 00:00:00 2001 From: Stanislav Brabec Date: Wed, 9 May 2018 18:08:32 +0200 Subject: lscpu, chcpu: Avoid use of the old CPU macros The old CPU macros are limited to 1024 cores. As a result, lscpu cannot count sockets on large systems. Use new scalable macros. Signed-off-by: Stanislav Brabec Cc: Michael Matz --- sys-utils/chcpu.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'sys-utils/chcpu.c') diff --git a/sys-utils/chcpu.c b/sys-utils/chcpu.c index 12e52d887..f32b7a6fc 100644 --- a/sys-utils/chcpu.c +++ b/sys-utils/chcpu.c @@ -81,7 +81,7 @@ static int cpu_enable(cpu_set_t *cpu_set, size_t setsize, int enable) size_t fails = 0; for (cpu = 0; cpu < setsize; cpu++) { - if (!CPU_ISSET(cpu, cpu_set)) + if (!CPU_ISSET_S(cpu, setsize, cpu_set)) continue; if (!path_exist(_PATH_SYS_CPU "/cpu%d", cpu)) { warnx(_("CPU %u does not exist"), cpu); @@ -127,7 +127,7 @@ static int cpu_enable(cpu_set_t *cpu_set, size_t setsize, int enable) } else { printf(_("CPU %u disabled\n"), cpu); if (onlinecpus) - CPU_CLR(cpu, onlinecpus); + CPU_CLR_S(cpu, setsize, onlinecpus); } } } @@ -173,7 +173,7 @@ static int cpu_configure(cpu_set_t *cpu_set, size_t setsize, int configure) size_t fails = 0; for (cpu = 0; cpu < setsize; cpu++) { - if (!CPU_ISSET(cpu, cpu_set)) + if (!CPU_ISSET_S(cpu, setsize, cpu_set)) continue; if (!path_exist(_PATH_SYS_CPU "/cpu%d", cpu)) { warnx(_("CPU %u does not exist"), cpu); -- cgit v1.2.3-55-g7522