summaryrefslogtreecommitdiffstats
path: root/usr.bin/cpuset
diff options
context:
space:
mode:
authorjeff <jeff@FreeBSD.org>2008-03-05 01:49:20 +0000
committerjeff <jeff@FreeBSD.org>2008-03-05 01:49:20 +0000
commit7e2fbaa872a30c5fcfa4206fd26455dcdcddb698 (patch)
tree16840d6ed4e15946d5c1b5f5af333569d3d610b4 /usr.bin/cpuset
parented2af560699691d50dc3a8de204f01066be5c2d2 (diff)
downloadFreeBSD-src-7e2fbaa872a30c5fcfa4206fd26455dcdcddb698.zip
FreeBSD-src-7e2fbaa872a30c5fcfa4206fd26455dcdcddb698.tar.gz
- Verify that when a user supplies a mask that is bigger than the kernel
mask none of the upper bits are set. - Be more careful about enforcing the boundaries of masks and child sets. - Introduce a few more CPU_* macros for implementing these tests. - Change the cpusetsize argument to be bytes rather than bits to match other apis. Sponsored by: Nokia
Diffstat (limited to 'usr.bin/cpuset')
-rw-r--r--usr.bin/cpuset/cpuset.c15
1 files changed, 7 insertions, 8 deletions
diff --git a/usr.bin/cpuset/cpuset.c b/usr.bin/cpuset/cpuset.c
index 699e096e..23c4b79 100644
--- a/usr.bin/cpuset/cpuset.c
+++ b/usr.bin/cpuset/cpuset.c
@@ -128,7 +128,7 @@ parselist(char *list, cpuset_t *mask)
}
return;
parserr:
- errx(EXIT_FAILURE, "Malformed cpu list %s", list);
+ errx(EXIT_FAILURE, "Malformed cpu-list %s", list);
}
static void
@@ -157,8 +157,7 @@ printaffinity(void)
{
cpuset_t mask;
- if (cpuset_getaffinity(level, which, id, CPU_SETSIZE,
- &mask) != 0)
+ if (cpuset_getaffinity(level, which, id, sizeof(mask), &mask) != 0)
err(EXIT_FAILURE, "getaffinity");
printf("%s %jd%s mask: ", whichnames[which], (intmax_t)id,
levelnames[level]);
@@ -274,7 +273,7 @@ main(int argc, char *argv[])
}
if (lflag) {
if (cpuset_setaffinity(level, which, -1,
- CPU_SETSIZE, &mask) != 0)
+ sizeof(mask), &mask) != 0)
err(EXIT_FAILURE, "setaffinity");
}
errno = 0;
@@ -304,7 +303,7 @@ main(int argc, char *argv[])
id = pid;
}
if (lflag) {
- if (cpuset_setaffinity(level, which, id, CPU_SETSIZE,
+ if (cpuset_setaffinity(level, which, id, sizeof(mask),
&mask) != 0)
err(EXIT_FAILURE, "setaffinity");
}
@@ -317,11 +316,11 @@ usage(void)
{
fprintf(stderr,
- "usage: cpuset [-l cpu list] [-i | -s setid] cmd ...\n");
+ "usage: cpuset [-l cpu-list] [-i | -s setid] cmd ...\n");
fprintf(stderr,
- " cpuset [-l cpu list] [-s setid] -p pid\n");
+ " cpuset [-l cpu-list] [-s setid] -p pid\n");
fprintf(stderr,
- " cpuset [-cr] [-l cpu list] [-p pid | -t tid | -s setid]\n");
+ " cpuset [-cr] [-l cpu-list] [-p pid | -t tid | -s setid]\n");
fprintf(stderr,
" cpuset [-cgir] [-p pid | -t tid | -s setid]\n");
exit(1);
OpenPOWER on IntegriCloud