diff options
author | Stanislav Brabec | 2018-05-09 18:08:32 +0200 |
---|---|---|
committer | Karel Zak | 2018-05-10 11:41:23 +0200 |
commit | 538b50cb0a4aac56b6b3b6e4d1e8ce886854c6d8 (patch) | |
tree | 28bfe412d74fe6d822aac245279c9f82d9bd04ca /sys-utils/chcpu.c | |
parent | last: fix false positive compiler warning (diff) | |
download | kernel-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.c | 6 |
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); |