summaryrefslogtreecommitdiff
path: root/usr.bin/cpuset
diff options
context:
space:
mode:
authorSimon J. Gerraty <sjg@FreeBSD.org>2015-05-27 01:19:58 +0000
committerSimon J. Gerraty <sjg@FreeBSD.org>2015-05-27 01:19:58 +0000
commit98e0ffaefb0f241cda3a72395d3be04192ae0d47 (patch)
tree55c065b6730aaac2afb6c29933ee6ec5fa4c4249 /usr.bin/cpuset
parentb17ff922d4072ae132ece458f5b5d74a236880ac (diff)
parente81032ad243db32b8fd615b2d55ee94b9f6a5b6a (diff)
downloadsrc-test-98e0ffaefb0f241cda3a72395d3be04192ae0d47.tar.gz
src-test-98e0ffaefb0f241cda3a72395d3be04192ae0d47.zip
Merge sync of head
Notes
Notes: svn path=/projects/bmake/; revision=283595
Diffstat (limited to 'usr.bin/cpuset')
-rw-r--r--usr.bin/cpuset/cpuset.113
-rw-r--r--usr.bin/cpuset/cpuset.c30
2 files changed, 25 insertions, 18 deletions
diff --git a/usr.bin/cpuset/cpuset.1 b/usr.bin/cpuset/cpuset.1
index 8ea2702499f13..174eeb6a201a9 100644
--- a/usr.bin/cpuset/cpuset.1
+++ b/usr.bin/cpuset/cpuset.1
@@ -25,7 +25,7 @@
.\"
.\" $FreeBSD$
.\"
-.Dd January 14, 2011
+.Dd January 8, 2015
.Dt CPUSET 1
.Os
.Sh NAME
@@ -46,12 +46,13 @@
.Fl C
.Fl p Ar pid
.Nm
-.Op Fl cr
+.Op Fl c
.Op Fl l Ar cpu-list
.Op Fl j Ar jailid | Fl p Ar pid | Fl t Ar tid | Fl s Ar setid | Fl x Ar irq
.Nm
-.Op Fl cgir
-.Op Fl j Ar jailid | Fl p Ar pid | Fl t Ar tid | Fl s Ar setid | Fl x Ar irq
+.Fl g
+.Op Fl cir
+.Op Fl d Ar domain | j Ar jailid | Fl p Ar pid | Fl t Ar tid | Fl s Ar setid | Fl x Ar irq
.Sh DESCRIPTION
The
.Nm
@@ -62,7 +63,7 @@ about processor binding, sets, and available processors in the system.
.Nm
requires a target to modify or query.
The target may be specified as a command, process id, thread id, a
-cpuset id, an irq or a jail id.
+cpuset id, an irq, a jail id, or a NUMA domain.
Using
.Fl g
the target's set id or mask may be queried.
@@ -108,6 +109,8 @@ Create a new cpuset and assign the target process to that set.
.It Fl c
The requested operation should reference the cpuset available via the
target specifier.
+.It Fl d Ar domain
+Specifies a NUMA domain id as the target of the operation.
.It Fl g
Causes
.Nm
diff --git a/usr.bin/cpuset/cpuset.c b/usr.bin/cpuset/cpuset.c
index 898c3e5ed8ee2..c619259c306ec 100644
--- a/usr.bin/cpuset/cpuset.c
+++ b/usr.bin/cpuset/cpuset.c
@@ -48,6 +48,7 @@ __FBSDID("$FreeBSD$");
static int Cflag;
static int cflag;
+static int dflag;
static int gflag;
static int iflag;
static int jflag;
@@ -161,7 +162,8 @@ printset(cpuset_t *mask)
printf("\n");
}
-static const char *whichnames[] = { NULL, "tid", "pid", "cpuset", "irq", "jail" };
+static const char *whichnames[] = { NULL, "tid", "pid", "cpuset", "irq", "jail",
+ "domain" };
static const char *levelnames[] = { NULL, " root", " cpuset", "" };
static void
@@ -206,17 +208,20 @@ main(int argc, char *argv[])
level = CPU_LEVEL_WHICH;
which = CPU_WHICH_PID;
id = pid = tid = setid = -1;
- while ((ch = getopt(argc, argv, "Ccgij:l:p:rs:t:x:")) != -1) {
+ while ((ch = getopt(argc, argv, "Ccd:gij:l:p:rs:t:x:")) != -1) {
switch (ch) {
case 'C':
Cflag = 1;
break;
case 'c':
- if (rflag)
- usage();
cflag = 1;
level = CPU_LEVEL_CPUSET;
break;
+ case 'd':
+ dflag = 1;
+ which = CPU_WHICH_DOMAIN;
+ id = atoi(optarg);
+ break;
case 'g':
gflag = 1;
break;
@@ -238,8 +243,6 @@ main(int argc, char *argv[])
id = pid = atoi(optarg);
break;
case 'r':
- if (cflag)
- usage();
level = CPU_LEVEL_ROOT;
rflag = 1;
break;
@@ -268,7 +271,7 @@ main(int argc, char *argv[])
if (argc || Cflag || lflag)
usage();
/* Only one identity specifier. */
- if (jflag + xflag + sflag + pflag + tflag > 1)
+ if (dflag + jflag + xflag + sflag + pflag + tflag > 1)
usage();
if (iflag)
printsetid();
@@ -276,13 +279,13 @@ main(int argc, char *argv[])
printaffinity();
exit(EXIT_SUCCESS);
}
- if (iflag)
+ if (dflag || iflag || rflag)
usage();
/*
* The user wants to run a command with a set and possibly cpumask.
*/
if (argc) {
- if (Cflag | pflag | rflag | tflag | xflag | jflag)
+ if (Cflag || pflag || tflag || xflag || jflag)
usage();
if (sflag) {
if (cpuset_setid(CPU_WHICH_PID, -1, setid))
@@ -303,9 +306,9 @@ main(int argc, char *argv[])
/*
* We're modifying something that presently exists.
*/
- if (Cflag && (sflag || rflag || !pflag || tflag || xflag || jflag))
+ if (Cflag && (jflag || !pflag || sflag || tflag || xflag))
usage();
- if (!lflag && (cflag || rflag))
+ if (!lflag && cflag)
usage();
if (!lflag && !(Cflag || sflag))
usage();
@@ -354,8 +357,9 @@ usage(void)
fprintf(stderr,
" cpuset [-c] [-l cpu-list] -C -p pid\n");
fprintf(stderr,
- " cpuset [-cr] [-l cpu-list] [-j jailid | -p pid | -t tid | -s setid | -x irq]\n");
+ " cpuset [-c] [-l cpu-list] [-j jailid | -p pid | -t tid | -s setid | -x irq]\n");
fprintf(stderr,
- " cpuset [-cgir] [-j jailid | -p pid | -t tid | -s setid | -x irq]\n");
+ " cpuset -g [-cir] [-d domain | -j jailid | -p pid | -t tid | -s setid |\n"
+ " -x irq]\n");
exit(1);
}