if cpusetsize is low, our code incorrectly looked beyond the end of the array, found random bits and usually complained that more than one is set. Use the correct set size, as specified by the user.
Fixes #771. Signed-off-by: Nadav Har'El <[email protected]> --- libc/pthread.cc | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/libc/pthread.cc b/libc/pthread.cc index 631eb08..1e6d357 100644 --- a/libc/pthread.cc +++ b/libc/pthread.cc @@ -948,7 +948,7 @@ static int setaffinity(sched::thread* t, size_t cpusetsize, // Having a cpuset with no CPUs in it is invalid. return EINVAL; } else if (count == 1) { - for (size_t i = 0; i < __CPU_SETSIZE; i++) { + for (size_t i = 0; i < cpusetsize * 8; i++) { if (CPU_ISSET(i, cpuset)) { if (i < sched::cpus.size()) { sched::thread::pin(t, sched::cpus[i]); -- 2.5.5 -- You received this message because you are subscribed to the Google Groups "OSv Development" group. To unsubscribe from this group and stop receiving emails from it, send an email to [email protected]. For more options, visit https://groups.google.com/d/optout.
