- When running a new command cause cpuset to operate on the per-thread mask

by default rather than the setmask.  This is consistent with the linux
   tool and more consistent with the notion that the default level is
   the process level.  The cpuset mask can still be modified by specifying
   the -c option.  You can not set the per-thread and cpuset mask in
   a single command.
 - Update the man page to reflect this change.

Contributed by:	gallatin
This commit is contained in:
Jeff Roberson 2008-03-12 23:54:40 +00:00
parent 90eb3b443d
commit cffe6e824b
Notes: svn2git 2020-12-20 02:59:44 +00:00
svn path=/head/; revision=177131
2 changed files with 8 additions and 4 deletions

View File

@ -89,8 +89,12 @@ queried using
When running a command it may join a set specified with
.Fl s
otherwise a new set is created.
In addition, a mask for the set may be specified using
In addition, a mask for the command may be specified using
.Fl l .
When used in conjunction with
.Fl c
the mask modifies the supplied or created set rather than the private mask
for the thread.
.Pp
The options are as follows:
.Bl -tag -width ".Fl l Ar cpu-list"
@ -127,7 +131,7 @@ Specifies a thread id as the target of the operation.
Create a new group with CPUs 0-4 inclusive and run
.Pa /bin/sh
on it:
.Dl cpuset -l 0-4 /bin/sh
.Dl cpuset -c -l 0-4 /bin/sh
.Pp
Query the mask of CPUs the
.Aq sh pid

View File

@ -257,7 +257,7 @@ main(int argc, char *argv[])
* The user wants to run a command with a set and possibly cpumask.
*/
if (argc) {
if (pflag | rflag | tflag || cflag)
if (pflag | rflag | tflag)
usage();
if (sflag) {
if (cpuset_setid(CPU_WHICH_PID, -1, setid))
@ -267,7 +267,7 @@ main(int argc, char *argv[])
err(argc, "newid");
}
if (lflag) {
if (cpuset_setaffinity(CPU_LEVEL_CPUSET, CPU_WHICH_PID,
if (cpuset_setaffinity(level, CPU_WHICH_PID,
-1, sizeof(mask), &mask) != 0)
err(EXIT_FAILURE, "setaffinity");
}