ioprio_get and ioprio_set system call accept not only process ID but
also process group ID(pgid) and user ID(uid) to specify the target
process(es). However, ionice command accepts only process ID. With
this patch a user can specify the target processes with pgid(-P
option) and uid(-u option).
[kzak@redhat.com: - tiny cleanup in usage()]
Signed-off-by: Masatake YAMATO <yamato@redhat.com>
Signed-off-by: Karel Zak <kzak@redhat.com>
A user is always allowed to change the CPU affinity of his or her
own processes. CAP_SYS_NICE is only required to change the affinity
of another user's process.
Signed-off-by: Rik van Riel <riel@redhat.com>
Reported-by: Joe Mario <jmario@redhat.com>
And mention in manual that the default is referring to the internal
default of this command, not the Linux system default. Manual page
example also tries to be a little more complete how to use the command.
Signed-off-by: Sami Kerola <kerolasa@iki.fi>
The unsuspecting user might use taskset -a mask command. Behavior then
is to exec with no affinity applied at all. Better handled by ignoring
all_tasks if no pid was given.
Signed-off-by: Daniel Stodden <daniel.stodden@gmail.com>
The global variable $(LDADD) is always used if program_LDADD is
not specified. Let's use $LDADD everywhere to avoid exceptions for
people who need to specify global $LDADD.
Signed-off-by: Karel Zak <kzak@redhat.com>
Several horizontal lists are turned to vertical, and sorted to
alphabetical order. Additionally spaces are converted to tabs where
ever possible.
Signed-off-by: Sami Kerola <kerolasa@iki.fi>
Use dates without the day, use the full month name, put "util-linux" in
the lower left corner, and "User Commands" or "System Administration"
at the top center.
Also improve here and there the one-line program description.
Signed-off-by: Benno Schulenberg <bensberg@justemail.net>
This is a preparation patch for chcpu. If a cpu should be added to
a cpu_set where the cpu doesn't fit into the cpu_set this got silently
ignored.
Since the cpu-list is user space provided it should be checked if cpus
are specified that are completely out of range of the system.
In order to do that add a parameter which specifies if cpulist_parse()
should fail if it parses a cpu-list with "impossible" cpus.
The current callers have been converted so they behave like before.
Signed-off-by: Heiko Carstens <heiko.carstens@de.ibm.com>
* replace errx() with warnx() for unknown -c class
The right place to check I/O scheduler features is in kernel. We should
not try to be more smart than kernel.
* make the code ready (robust) for unknown sched.classes
* fix -t behavior
old version:
$ ionice -c 4 -t bash
ionice: bad prio class 4
new version:
$ ionice -c 4 -t bash
Reported-by: Voelker, Bernhard" <bernhard.voelker@siemens-enterprise.com>
Signed-off-by: Karel Zak <kzak@redhat.com>
ionice : print the current I/O prio.
ionice COMMAND : exec command with default (best-effort) class
ionice -p PID [...] : return info about the PID(s)
ionice -c CLASS COMMAND : exec command with the class
ionice -c CLASS -p PID [...] : modify PID(s) class
This should be backwardly compatible and also compatible with nice(1)
from coreutils.
Signed-off-by: Karel Zak <kzak@redhat.com>
taskset.c should add these lines:
#include <sched.h> for sched_getaffinity, etc
#include <stddef.h> for size_t
#include <string.h> for memset
Signed-off-by: Sami Kerola <kerolasa@iki.fi>
$ ionice 123
none: prio 4
none: prio 4
It calls ioprio_get(0x1, 0) and ioprio_get(0x1, 123), because the
code does not check it the "-p" options was specified.
The proper command line syntax is:
$ ionice -p 123
and the ioprio_get() should be called only once.
Signed-off-by: Karel Zak <kzak@redhat.com>
* make the code more robust
* follow kernel conventions for variable names
(data = classdata, ioprio = classdata | class)
Signed-off-by: Karel Zak <kzak@redhat.com>
chrt.c:158:16: warning: comparison of integers of different
signs: 'int' and 'unsigned long' [-Wsign-compare]
Signed-off-by: Sami Kerola <kerolasa@iki.fi>
With this option we can operate on all the thread group of a process not just
for changes, but also when obtaining information via sched_getscheduler().
Signed-off-by: Davidlohr Bueso <dave@gnu.org>
Add a new '-a' option to view/modify the CPU affinity for an entire
group of threads belonging to a given PID. We create two new
functions, print_affinity() and do_taskset() for code simplification.
Example:
zeus@jilguero:~/src/util-linux/schedutils$ ./taskset -a -p 01 3142
pid 3142's current affinity mask: 2
pid 3142's new affinity mask: 1
pid 3164's current affinity mask: 2
pid 3164's new affinity mask: 1
pid 854's current affinity mask: 2
pid 854's new affinity mask: 1
[kzak@redhat.com: - clean up
- move variables to struct taskset]
Signed-off-by: Davidlohr Bueso <dave@gnu.org>
Tested-by: Jonathan Gonzalez <zeus@gnu.org>
Signed-off-by: Karel Zak <kzak@redhat.com>