summaryrefslogtreecommitdiffstats
path: root/usr.bin/cpuset
diff options
context:
space:
mode:
authorjeff <jeff@FreeBSD.org>2008-04-11 03:27:42 +0000
committerjeff <jeff@FreeBSD.org>2008-04-11 03:27:42 +0000
commit88caf3bcc9a7a57216f179df093e02692dbc125e (patch)
treec3dbd7d7169829465c132fb2a50797f166aa89a8 /usr.bin/cpuset
parent8efb03d60e1c0395890e9ac099d156d71015b041 (diff)
downloadFreeBSD-src-88caf3bcc9a7a57216f179df093e02692dbc125e.zip
FreeBSD-src-88caf3bcc9a7a57216f179df093e02692dbc125e.tar.gz
- Add support for interrupt bindig to cpuset(1). Interrupts are bound
by specifying the interrupt with -x <irq>. The irq number matches those displayed by vmstat -i. Sponsored by: Nokia
Diffstat (limited to 'usr.bin/cpuset')
-rw-r--r--usr.bin/cpuset/cpuset.c26
1 files changed, 19 insertions, 7 deletions
diff --git a/usr.bin/cpuset/cpuset.c b/usr.bin/cpuset/cpuset.c
index c31ebb7..5858a3d 100644
--- a/usr.bin/cpuset/cpuset.c
+++ b/usr.bin/cpuset/cpuset.c
@@ -2,6 +2,9 @@
* Copyright (c) 2007, 2008 Jeffrey Roberson <jeff@freebsd.org>
* All rights reserved.
*
+ * Copyright (c) 2008 Nokia Corporation
+ * All rights reserved.
+ *
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
@@ -51,6 +54,7 @@ int pflag;
int rflag;
int sflag;
int tflag;
+int xflag;
id_t id;
cpulevel_t level;
cpuwhich_t which;
@@ -149,7 +153,7 @@ printset(cpuset_t *mask)
printf("\n");
}
-const char *whichnames[] = { NULL, "tid", "pid", "cpuset" };
+const char *whichnames[] = { NULL, "tid", "pid", "cpuset", "irq" };
const char *levelnames[] = { NULL, " root", " cpuset", "" };
static void
@@ -194,7 +198,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:")) != -1) {
+ while ((ch = getopt(argc, argv, "cgil:p:rs:t:x:")) != -1) {
switch (ch) {
case 'c':
if (rflag)
@@ -233,6 +237,11 @@ main(int argc, char *argv[])
which = CPU_WHICH_TID;
id = tid = atoi(optarg);
break;
+ case 'x':
+ xflag = 1;
+ which = CPU_WHICH_IRQ;
+ id = atoi(optarg);
+ break;
default:
usage();
}
@@ -243,7 +252,7 @@ main(int argc, char *argv[])
if (argc || lflag)
usage();
/* Only one identity specifier. */
- if (sflag + pflag + tflag > 1)
+ if (xflag + sflag + pflag + tflag > 1)
usage();
if (iflag)
printsetid();
@@ -257,7 +266,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)
+ if (pflag | rflag | tflag | xflag)
usage();
if (sflag) {
if (cpuset_setid(CPU_WHICH_PID, -1, setid))
@@ -283,7 +292,10 @@ main(int argc, char *argv[])
if (!lflag && !sflag)
usage();
/* You can only set a mask on a thread. */
- if (tflag && (sflag || pflag))
+ if (tflag && (sflag | pflag | xflag))
+ usage();
+ /* You can only set a mask on an irq. */
+ if (xflag && (pflag | sflag | tflag))
usage();
if (pflag && sflag) {
if (cpuset_setid(CPU_WHICH_PID, pid, setid))
@@ -313,8 +325,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]\n");
+ " cpuset [-cr] [-l cpu-list] [-p pid | -t tid | -s setid | -x irq]\n");
fprintf(stderr,
- " cpuset [-cgir] [-p pid | -t tid | -s setid]\n");
+ " cpuset [-cgir] [-p pid | -t tid | -s setid | -x irq]\n");
exit(1);
}
OpenPOWER on IntegriCloud