summaryrefslogtreecommitdiffstats
path: root/schedutils/ionice.c
Commit message (Collapse)AuthorAgeFilesLines
* misc: consolidate version printing and close_stdout()Karel Zak2019-04-161-3/+3
| | | | Signed-off-by: Karel Zak <kzak@redhat.com>
* schedutils: use errexec()Karel Zak2018-02-011-1/+1
| | | | Signed-off-by: Karel Zak <kzak@redhat.com>
* misc: consolidate macro style USAGE_HELP_OPTIONSRuediger Meier2017-06-291-2/+2
| | | | | | | | | 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>
* misc: introduce print_usage_help_options()Ruediger Meier2017-06-271-2/+1Star
| | | | | | | | | | | | 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>
* misc: never use usage(stderr)Ruediger Meier2017-06-261-6/+8
| | | | | | | Here we fix all cases where we have usage(FILE*) functions. Signed-off-by: Ruediger Meier <ruediger.meier@ga-group.nl>
* misc: add static keyword to where needed [smatch scan]Sami Kerola2017-02-201-1/+1
| | | | | | | text-utils/rev.c:68:9: warning: symbol 'buf' was not declared. Should it be static? Signed-off-by: Sami Kerola <kerolasa@iki.fi>
* Use --help suggestion on invalid optionKarel Zak2016-12-191-1/+1
| | | | | | | | The current default is to print all usage() output. This is overkill in many case. Addresses: https://github.com/karelzak/util-linux/issues/338 Signed-off-by: Karel Zak <kzak@redhat.com>
* ionice: drop the duplicate docstringBenno Schulenberg2015-01-261-2/+0Star
| | | | Signed-off-by: Benno Schulenberg <bensberg@justemail.net>
* textual: add a docstring to most of the utilitiesBenno Schulenberg2015-01-061-0/+3
| | | | | | | | | 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>
* textual: slice up and standardize the usage text of ioniceBenno Schulenberg2014-05-061-27/+27
| | | | | | | 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>
* ionice: add a missing error messageBenno Schulenberg2014-05-061-0/+1
| | | | Signed-off-by: Benno Schulenberg <bensberg@justemail.net>
* ionice: add the way to specify the target processes with pgid and uidMasatake YAMATO2014-02-171-22/+48
| | | | | | | | | | | | | 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>
* ionice: Fix output for case ioclass==0Michael Bunk2014-01-151-1/+1
| | | | output "none" instead of "unknown"
* ionice: keep output backwardly compatibleKarel Zak2013-03-041-1/+1
| | | | | | ...bug introduced by 8c219bf463dbbae412767d269bff1cdd4e4bf4a5 Signed-off-by: Karel Zak <kzak@redhat.com>
* translation: unify exec error messagesSami Kerola2013-02-061-1/+1
| | | | Signed-off-by: Sami Kerola <kerolasa@iki.fi>
* textual: gettextize several overlooked messagesBenno Schulenberg2013-01-251-2/+2
| | | | | | Also improve the clarity of some of them. Signed-off-by: Benno Schulenberg <bensberg@justemail.net>
* schedutils: cleanup strtoxx_or_err()Karel Zak2012-05-151-6/+6
| | | | Signed-off-by: Karel Zak <kzak@redhat.com>
* schedutils: verify writing to streams was successfulSami Kerola2012-04-041-0/+2
| | | | Signed-off-by: Sami Kerola <kerolasa@iki.fi>
* ionice: fix compiler warnings [-Wsign-compare]Karel Zak2011-08-011-2/+2
| | | | Signed-off-by: Karel Zak <kzak@redhat.com>
* ionice: make -t more tolerantKarel Zak2011-07-221-5/+11
| | | | | | | | | | | | | | | | | | | | | * 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: allow to use names for -c <class>Karel Zak2011-07-221-9/+29
| | | | | | | | for example: $ ionice -c best-effort bash Signed-off-by: Karel Zak <kzak@redhat.com>
* ionice: improve command line interpretationKarel Zak2011-07-221-19/+28
| | | | | | | | | | | | | 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: coding style fixesSami Kerola2011-07-211-5/+4Star
| | | | | Signed-off-by: Sami Kerola <kerolasa@iki.fi> Signed-off-by: Karel Zak <kzak@redhat.com>
* ionice: fix -V outputSami Kerola2011-07-211-1/+1
| | | | Signed-off-by: Sami Kerola <kerolasa@iki.fi>
* ionice: fix -pKarel Zak2011-07-211-2/+6
| | | | | | | | | | | | | | | | | $ 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>
* ionice: IOPRIO_PRIO_* macrosKarel Zak2011-07-211-23/+30
| | | | | | | | * make the code more robust * follow kernel conventions for variable names (data = classdata, ioprio = classdata | class) Signed-off-by: Karel Zak <kzak@redhat.com>
* ionice: add long optionsSami Kerola2011-07-211-16/+38
| | | | | Signed-off-by: Sami Kerola <kerolasa@iki.fi> Signed-off-by: Karel Zak <kzak@redhat.com>
* build-sys: provide alternatives for err, errx, warn and warnxFabian Groffen2011-02-141-2/+1Star
| | | | | | | | 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>
* schedutils: remove unneeded header filesDavidlohr Bueso2011-02-081-2/+0Star
| | | | Signed-off-by: Davidlohr Bueso <dave@gnu.org>
* lib: [strutils] general purpose string handling functionsDavidlohr Bueso2010-11-231-6/+6
| | | | | | | | | | | | | 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>
* taskset: proper numbers parsingKarel Zak2010-09-301-27/+7Star
| | | | | Reported-by: Davidlohr Bueso <dave@gnu.org> Signed-off-by: Karel Zak <kzak@redhat.com>
* ionice: non-cryptic error message when ionice can't execvpÆvar Arnfjörð Bjarmason2010-05-061-1/+1
| | | | | | | | | | | | | | | | 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>
* ionice: fix typoPierre Hauweele2010-03-141-1/+1
| | | | Signed-off-by: Pierre Hauweele <antegallya@gmail.com>
* ionice: Allow setting the none classJakob Unterwurzacher2009-05-271-2/+4
| | | | | | | | | | 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>
* ionice: change Jens Axboe's emailKarel Zak2009-04-231-1/+1
| | | | | | | | Based on util-linux-2.14.2-schedutils_fix_email.patch from SUSE src.rpm package. Signed-off-by: Karel Zak <kzak@redhat.com>
* ionice: add strtol() checks, cleanup usage text and man pageKarel Zak2008-09-061-18/+40
| | | | | | | | | | | | | | | | | | | * 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>
* ionice: let -p handle multiple PIDsStephan Maka2008-09-051-27/+54
| | | | | | | | | | 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>
* ionice: cleanup error messages, add NLS supportKarel Zak2008-08-141-25/+29
| | | | Signed-off-by: Karel Zak <kzak@redhat.com>
* ionice: add -t optionLubomir Kundrak2008-06-161-4/+10
| | | | | | | | | | | | | | | | | | | | | | | 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>
* build-sys: unify method for checking system calls and fallback handlingMike Frysinger2007-09-201-32/+0Star
| | | | | | Co-Author: Stepan Kasal <skasal@redhat.com> Signed-off-by: Mike Frysinger <vapier@gentoo.org> Signed-off-by: Stepan Kasal <skasal@redhat.com>
* ionice: clean up error handlingMatthias Koenig2007-08-271-7/+12
| | | | | | | | | 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>
* ionice: cleanup usage for idle classMatthias Koenig2007-07-251-4/+9
| | | | | | | | 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>
* ionice: prefer SYS_ioprio_{set,get} from glibc to hardcoded versionKarel Zak2007-07-161-26/+33
| | | | | | | 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>
* ionice: fix ionice build on sparcDavid Miller2007-07-021-0/+3
| | | | | | Provide the proper syscall numbers for this architecture. Signed-off-by: David S. Miller <davem@davemloft.net>
* Imported from util-linux-2.13-pre1 tarball.Karel Zak2006-12-071-0/+143