changed in include/c.h and applied via sed:
sed -i 's/fprintf.*\(USAGE_MAN_TAIL.*\)/printf(\1/' $(git ls-files -- "*.c")
sed -i 's/print_usage_help_options\(.*\);/printf(USAGE_HELP_OPTIONS\1);/' $(git ls-files -- "*.c")
Signed-off-by: Ruediger Meier <ruediger.meier@ga-group.nl>
Consolidate --help and --version descriptions. We are
now able to align them to the other options.
We changed include/c.h. The rest of this patch was
generated by sed, plus manually setting the right
alignment numbers. We do not change anything but
white spaces in the --help output.
Signed-off-by: Ruediger Meier <ruediger.meier@ga-group.nl>
This adds a concise description of a tool to its usage text.
A first form of this patch was proposed by Steven Honeyman
(see http://www.spinics.net/lists/util-linux-ng/msg09994.html).
Signed-off-by: Benno Schulenberg <bensberg@justemail.net>
Done for ease of translation and maintenance. Also improve the
clarity of some of the descriptions, and of one error message.
Signed-off-by: Benno Schulenberg <bensberg@justemail.net>
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>
* 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>
$ 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>
Solaris lacks err, errx, warn and warnx. This also means the err.h header
doesn't exist. Removed err.h include from all files, and included err.h from
c.h instead if it exists, otherwise alternatives are provided.
Signed-off-by: Fabian Groffen <grobian@gentoo.org>
This patch replaces a few functions used throughout the source:
* Renames getnum (from schedutils) to strtol_or_err
* Moves strtosize (from lib/strtosize.c)
* Moves xstrncpy (from include/xstrncpy.h)
* Adds strnlen, strnchr and strndup if not available (remove it from libmount utils)
A few Makefile.am files were modified to compile accordingly along with trivial renaming
in schedutils source code.
Signed-off-by: Davidlohr Bueso <dave@gnu.org>
Previously ionice would reply like this when it couldn't find the
command to execute:
$ ionice -c 3 does-not-exist
ionice: execvp failed: No such file or directory
Getting that message from cron because you haven't set the right $PATH
makes it hard to track down the problem. Now it says:
$ ionice -c 3 does-not-exist
ionice: executing does-not-exist failed: No such file or directory
Signed-off-by: Ævar Arnfjörð Bjarmason <avarab@gmail.com>
Allow users to set the "none" class on processes. Using the
none class has the distict advantage that the io priority
is inherited from the cpu nice level. Update the man page
to reflect the change.
Signed-off-by: Jakob Unterwurzacher <jakobunt@gmail.com>
Signed-off-by: Karel Zak <kzak@redhat.com>
* cleanup usage() output
* check strtol(); don't ignore wrong command line options
The original ionice design was a little broken, because it was
possible to specify a PID and also a COMMAND:
ionice -c2 -p 123 /bin/foo
but the command /bin/foo was executed without requested scheduling
class. That's stupid behaviour.
Now you have to use "-p PID" **or** COMMAND, but not both. Nothing is
ignored and all options are checked.
Signed-off-by: Karel Zak <kzak@redhat.com>
Makes ionice -p usable like renice, this time backwards compatible
[kzak@redhat.com: - fix coding style
- add ioprio_setpid()]
Signed-off-by: Stephan Maka <stephan@spaceboyz.net>
Signed-off-by: Karel Zak <kzak@redhat.com>
This patch allows "tolerant" behavior, i.e. proceeding even if
priority could not be set. This might be of use in case something
(selinux, old kernel, etc.) does not allow the requested scheduling
priority to be set.
This could be to some extend done as follows:
ionice -c3 command || command
but the downside is that one could not really tell if what failed was
setting priority or command itself, which could result in duplicate
command run.
This patch solves the situation, so that user can do
ionice -t -c3 command
Addresses-Red-Hat-Bugzilla: #443842
Signed-off-by: Lubomir Kundrak <lkundrak@redhat.com>
Signed-off-by: Karel Zak <kzak@redhat.com>
Print error in case execvp fails and use exit macros.
Based on patch by Bernhard Voelker <mail@bernhard-voelker.de>
Signed-off-by: Matthias Koenig <mkoenig@suse.de>
Signed-off-by: Karel Zak <kzak@redhat.com>
The idle class has no class data. It will print a warning if
a prio argument is given for it, since this will be ignored.
Output for idle class will not contain prio data.
Signed-off-by: Matthias Koenig <mkoenig@suse.de>
It's better to use glibc SYS_ioprio_{set,get} definitions rather than an
incomplete (not all archs) and hardcoded version from ionice.c.
Signed-off-by: Karel Zak <kzak@redhat.com>