From cffe6e824bdcd549f0a7ca7cde170e85dd6587f3 Mon Sep 17 00:00:00 2001 From: Jeff Roberson Date: Wed, 12 Mar 2008 23:54:40 +0000 Subject: [PATCH] - 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(-) diff --git a/usr.bin/cpuset/cpuset.1 b/usr.bin/cpuset/cpuset.1 index 00f9e81b823f..b97234a274e7 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 41a715dff9e9..c31ebb7fb04f 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"); }