Index: head/tools/tools/crypto/cryptotest.c =================================================================== --- head/tools/tools/crypto/cryptotest.c +++ head/tools/tools/crypto/cryptotest.c @@ -97,6 +97,7 @@ #include #include #include +#include #include #include @@ -468,6 +469,11 @@ if (threads > 1) { for (i = 0; i < threads; i++) if (fork() == 0) { + cpuset_t mask; + CPU_ZERO(&mask); + CPU_SET(i, &mask); + cpuset_setaffinity(CPU_LEVEL_WHICH, CPU_WHICH_PID, + -1, sizeof(mask), &mask); runtest(alg, count, size, cmd, &tvp[i]); exit(0); } @@ -573,6 +579,9 @@ } argc--, argv++; } + if (maxthreads > CPU_SETSIZE) + errx(EX_USAGE, "Too many threads, %d, choose fewer.", maxthreads); + if (nsizes == 0) { if (alg) sizes[nsizes++] = alg->blocksize;