aboutsummaryrefslogtreecommitdiff
path: root/usr.bin/cpuset
diff options
context:
space:
mode:
authorBjoern A. Zeeb <bz@FreeBSD.org>2008-11-29 14:32:14 +0000
committerBjoern A. Zeeb <bz@FreeBSD.org>2008-11-29 14:32:14 +0000
commit413628a7e3d23a897cd959638d325395e4c9691b (patch)
tree2b8f4835032d12a0e61cc40dad151e279cf7a49f /usr.bin/cpuset
parentf0f4475a13fe3545c10e9b3e8c69679c4abfb1b3 (diff)
downloadsrc-413628a7e3d23a897cd959638d325395e4c9691b.tar.gz
src-413628a7e3d23a897cd959638d325395e4c9691b.zip
Notes
Diffstat (limited to 'usr.bin/cpuset')
-rw-r--r--usr.bin/cpuset/cpuset.114
-rw-r--r--usr.bin/cpuset/cpuset.c22
2 files changed, 23 insertions, 13 deletions
diff --git a/usr.bin/cpuset/cpuset.1 b/usr.bin/cpuset/cpuset.1
index ba06e4833837..e8f559372c54 100644
--- a/usr.bin/cpuset/cpuset.1
+++ b/usr.bin/cpuset/cpuset.1
@@ -25,7 +25,7 @@
.\"
.\" $FreeBSD$
.\"
-.Dd March 11, 2008
+.Dd November 29, 2008
.Dt CPUSET 1
.Os
.Sh NAME
@@ -43,10 +43,10 @@
.Nm
.Op Fl cr
.Op Fl l Ar cpu-list
-.Op Fl p Ar pid | Fl r Ar tid | Fl s Ar setid
+.Op Fl j Ar jailid | Fl p Ar pid | Fl r Ar tid | Fl s Ar setid | Fl x Ar irq
.Nm
.Op Fl cgir
-.Op Fl p Ar pid | Fl r Ar tid | Fl s Ar setid
+.Op Fl j Ar jailid | Fl p Ar pid | Fl r Ar tid | Fl s Ar setid | Fl x Ar irq
.Sh DESCRIPTION
The
.Nm
@@ -56,8 +56,8 @@ about processor binding, sets, and available processors in the system.
.Pp
.Nm
requires a target to modify or query.
-The target may be specified as a command, process id, thread id, or a
-cpuset id.
+The target may be specified as a command, process id, thread id, a
+cpuset id, an irq or a jail id.
Using
.Fl g
the target's set id or mask may be queried.
@@ -111,6 +111,8 @@ the id of the target.
When used with the
.Fl g
option print the id rather than the valid mask of the target.
+.It Fl j Ar jailid
+Specifies a jail id as the target of the operation.
.It Fl l Ar cpu-list
Specifies a list of CPUs to apply to a target.
Specification may include
@@ -124,6 +126,8 @@ The requested operation should reference the root set available via the
target specifier.
.It Fl t Ar tid
Specifies a thread id as the target of the operation.
+.It Fl x Ar irq
+Specifies an irq as the target of the operation.
.El
.Sh EXIT STATUS
.Ex -std
diff --git a/usr.bin/cpuset/cpuset.c b/usr.bin/cpuset/cpuset.c
index 5858a3d07ccc..35b13afa0a4e 100644
--- a/usr.bin/cpuset/cpuset.c
+++ b/usr.bin/cpuset/cpuset.c
@@ -49,6 +49,7 @@ __FBSDID("$FreeBSD$");
int cflag;
int gflag;
int iflag;
+int jflag;
int lflag;
int pflag;
int rflag;
@@ -153,7 +154,7 @@ printset(cpuset_t *mask)
printf("\n");
}
-const char *whichnames[] = { NULL, "tid", "pid", "cpuset", "irq" };
+const char *whichnames[] = { NULL, "tid", "pid", "cpuset", "irq", "jail" };
const char *levelnames[] = { NULL, " root", " cpuset", "" };
static void
@@ -198,7 +199,7 @@ main(int argc, char *argv[])
level = CPU_LEVEL_WHICH;
which = CPU_WHICH_PID;
id = pid = tid = setid = -1;
- while ((ch = getopt(argc, argv, "cgil:p:rs:t:x:")) != -1) {
+ while ((ch = getopt(argc, argv, "cgij:l:p:rs:t:x:")) != -1) {
switch (ch) {
case 'c':
if (rflag)
@@ -212,6 +213,11 @@ main(int argc, char *argv[])
case 'i':
iflag = 1;
break;
+ case 'j':
+ jflag = 1;
+ which = CPU_WHICH_JAIL;
+ id = atoi(optarg);
+ break;
case 'l':
lflag = 1;
parselist(optarg, &mask);
@@ -252,7 +258,7 @@ main(int argc, char *argv[])
if (argc || lflag)
usage();
/* Only one identity specifier. */
- if (xflag + sflag + pflag + tflag > 1)
+ if (jflag + xflag + sflag + pflag + tflag > 1)
usage();
if (iflag)
printsetid();
@@ -266,7 +272,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 | xflag)
+ if (pflag | rflag | tflag | xflag | jflag)
usage();
if (sflag) {
if (cpuset_setid(CPU_WHICH_PID, -1, setid))
@@ -292,10 +298,10 @@ main(int argc, char *argv[])
if (!lflag && !sflag)
usage();
/* You can only set a mask on a thread. */
- if (tflag && (sflag | pflag | xflag))
+ if (tflag && (sflag | pflag | xflag | jflag))
usage();
/* You can only set a mask on an irq. */
- if (xflag && (pflag | sflag | tflag))
+ if (xflag && (jflag | pflag | sflag | tflag))
usage();
if (pflag && sflag) {
if (cpuset_setid(CPU_WHICH_PID, pid, setid))
@@ -325,8 +331,8 @@ usage(void)
fprintf(stderr,
" cpuset [-l cpu-list] [-s setid] -p pid\n");
fprintf(stderr,
- " cpuset [-cr] [-l cpu-list] [-p pid | -t tid | -s setid | -x irq]\n");
+ " cpuset [-cr] [-l cpu-list] [-j jailid | -p pid | -t tid | -s setid | -x irq]\n");
fprintf(stderr,
- " cpuset [-cgir] [-p pid | -t tid | -s setid | -x irq]\n");
+ " cpuset [-cgir] [-j jailid | -p pid | -t tid | -s setid | -x irq]\n");
exit(1);
}