summaryrefslogtreecommitdiffstats
path: root/usr.bin/cpuset/cpuset.c
diff options
context:
space:
mode:
authorjeff <jeff@FreeBSD.org>2008-03-05 02:10:43 +0000
committerjeff <jeff@FreeBSD.org>2008-03-05 02:10:43 +0000
commit0abc0885372d5c0a1ddcf71604c747aa76062639 (patch)
tree759453230560895b41fd5379ada22a3100d78a00 /usr.bin/cpuset/cpuset.c
parent7e2fbaa872a30c5fcfa4206fd26455dcdcddb698 (diff)
downloadFreeBSD-src-0abc0885372d5c0a1ddcf71604c747aa76062639.zip
FreeBSD-src-0abc0885372d5c0a1ddcf71604c747aa76062639.tar.gz
- Remove the -i argument when running a command to simplify things a
little bit and to prevent users from specifying a private mask that may later restrict other group changes. - Add a man page which brueffer generously contributed to. Sponsored by: Nokia
Diffstat (limited to 'usr.bin/cpuset/cpuset.c')
-rw-r--r--usr.bin/cpuset/cpuset.c19
1 files changed, 6 insertions, 13 deletions
diff --git a/usr.bin/cpuset/cpuset.c b/usr.bin/cpuset/cpuset.c
index 23c4b79..41a715d 100644
--- a/usr.bin/cpuset/cpuset.c
+++ b/usr.bin/cpuset/cpuset.c
@@ -251,29 +251,24 @@ main(int argc, char *argv[])
printaffinity();
exit(EXIT_SUCCESS);
}
+ if (iflag)
+ usage();
/*
* The user wants to run a command with a set and possibly cpumask.
*/
if (argc) {
if (pflag | rflag | tflag || cflag)
usage();
- if (sflag && iflag)
- usage();
if (sflag) {
if (cpuset_setid(CPU_WHICH_PID, -1, setid))
err(argc, "setid");
- which = CPU_WHICH_PID;
- level = CPU_LEVEL_WHICH;
- }
- if (iflag) {
+ } else {
if (cpuset(&setid))
err(argc, "newid");
- which = CPU_WHICH_CPUSET;
- level = CPU_LEVEL_WHICH;
}
if (lflag) {
- if (cpuset_setaffinity(level, which, -1,
- sizeof(mask), &mask) != 0)
+ if (cpuset_setaffinity(CPU_LEVEL_CPUSET, CPU_WHICH_PID,
+ -1, sizeof(mask), &mask) != 0)
err(EXIT_FAILURE, "setaffinity");
}
errno = 0;
@@ -283,8 +278,6 @@ main(int argc, char *argv[])
/*
* We're modifying something that presently exists.
*/
- if (iflag)
- usage();
if (!lflag && (cflag || rflag))
usage();
if (!lflag && !sflag)
@@ -316,7 +309,7 @@ usage(void)
{
fprintf(stderr,
- "usage: cpuset [-l cpu-list] [-i | -s setid] cmd ...\n");
+ "usage: cpuset [-l cpu-list] [-s setid] cmd ...\n");
fprintf(stderr,
" cpuset [-l cpu-list] [-s setid] -p pid\n");
fprintf(stderr,
OpenPOWER on IntegriCloud