taskset: (1ull < 65) like ops are not good, avoid that
This commit is contained in:
parent
95842fbc16
commit
44f0821259
@ -93,8 +93,10 @@ int taskset_main(int argc ATTRIBUTE_UNUSED, char **argv)
|
|||||||
unsigned i;
|
unsigned i;
|
||||||
/* Do not allow zero mask: */
|
/* Do not allow zero mask: */
|
||||||
unsigned long long m = xstrtoull_range(aff, 0, 1, ULLONG_MAX);
|
unsigned long long m = xstrtoull_range(aff, 0, 1, ULLONG_MAX);
|
||||||
|
enum { CNT_BIT = CPU_SETSIZE < sizeof(m)*8 ? CPU_SETSIZE : sizeof(m)*8 };
|
||||||
|
|
||||||
CPU_ZERO(&mask);
|
CPU_ZERO(&mask);
|
||||||
for (i = 0; i < CPU_SETSIZE; i++) {
|
for (i = 0; i < CNT_BIT; i++) {
|
||||||
unsigned long long bit = (1ULL << i);
|
unsigned long long bit = (1ULL << i);
|
||||||
if (bit & m)
|
if (bit & m)
|
||||||
CPU_SET(i, &mask);
|
CPU_SET(i, &mask);
|
||||||
|
Loading…
Reference in New Issue
Block a user