From 90cc368fe8d8875af227ffe20907bc15e7c6d2af Mon Sep 17 00:00:00 2001 From: jeff Date: Wed, 12 Mar 2008 23:54:40 +0000 Subject: - 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 --- usr.bin/cpuset/cpuset.1 | 8 ++++++-- usr.bin/cpuset/cpuset.c | 4 ++-- 2 files changed, 8 insertions(+), 4 deletions(-) (limited to 'usr.bin/cpuset') diff --git a/usr.bin/cpuset/cpuset.1 b/usr.bin/cpuset/cpuset.1 index 00f9e81..b97234a 100644 --- a/usr.bin/cpuset/cpuset.1 +++ b/usr.bin/cpuset/cpuset.1 @@ -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 diff --git a/usr.bin/cpuset/cpuset.c b/usr.bin/cpuset/cpuset.c index 41a715d..c31ebb7 100644 --- a/usr.bin/cpuset/cpuset.c +++ b/usr.bin/cpuset/cpuset.c @@ -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"); } -- cgit v1.1