summaryrefslogtreecommitdiffstats
path: root/sys-utils/chcpu.c
diff options
context:
space:
mode:
authorStanislav Brabec2018-05-09 18:08:32 +0200
committerKarel Zak2018-05-10 11:41:23 +0200
commit538b50cb0a4aac56b6b3b6e4d1e8ce886854c6d8 (patch)
tree28bfe412d74fe6d822aac245279c9f82d9bd04ca /sys-utils/chcpu.c
parentlast: fix false positive compiler warning (diff)
downloadkernel-qcow2-util-linux-538b50cb0a4aac56b6b3b6e4d1e8ce886854c6d8.tar.gz
kernel-qcow2-util-linux-538b50cb0a4aac56b6b3b6e4d1e8ce886854c6d8.tar.xz
kernel-qcow2-util-linux-538b50cb0a4aac56b6b3b6e4d1e8ce886854c6d8.zip
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 <sbrabec@suse.cz> Cc: Michael Matz <matz@suse.de>
Diffstat (limited to 'sys-utils/chcpu.c')
-rw-r--r--sys-utils/chcpu.c6
1 files changed, 3 insertions, 3 deletions
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);