Commit Graph

23 Commits

Author SHA1 Message Date
Sami Kerola a5e9b75fac ionice: coding style fixes
Signed-off-by: Sami Kerola <kerolasa@iki.fi>
Signed-off-by: Karel Zak <kzak@redhat.com>
2011-07-21 17:09:28 +02:00
Sami Kerola abd57eb3e3 ionice: fix -V output
Signed-off-by: Sami Kerola <kerolasa@iki.fi>
2011-07-21 17:04:36 +02:00
Karel Zak 7ab08ba3e5 ionice: fix -p
$ 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>
2011-07-21 17:02:52 +02:00
Karel Zak 560cdabbfa ionice: IOPRIO_PRIO_* macros
* make the code more robust
 * follow kernel conventions for variable names
   (data = classdata, ioprio = classdata | class)

Signed-off-by: Karel Zak <kzak@redhat.com>
2011-07-21 16:33:20 +02:00
Sami Kerola 976b7580e0 ionice: add long options
Signed-off-by: Sami Kerola <kerolasa@iki.fi>
Signed-off-by: Karel Zak <kzak@redhat.com>
2011-07-21 16:03:35 +02:00
Fabian Groffen eb76ca98b0 build-sys: provide alternatives for err, errx, warn and warnx
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>
2011-02-14 17:45:24 +01:00
Davidlohr Bueso f2f0dcaf11 schedutils: remove unneeded header files
Signed-off-by: Davidlohr Bueso <dave@gnu.org>
2011-02-08 16:23:28 +01:00
Davidlohr Bueso 8abcf29002 lib: [strutils] general purpose string handling functions
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>
2010-11-23 21:06:49 +01:00
Karel Zak 2429509658 taskset: proper numbers parsing
Reported-by: Davidlohr Bueso <dave@gnu.org>
Signed-off-by: Karel Zak <kzak@redhat.com>
2010-09-30 23:29:14 +02:00
Ævar Arnfjörð Bjarmason 048b81c9ff ionice: non-cryptic error message when ionice can't execvp
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>
2010-05-06 09:18:20 +02:00
Pierre Hauweele 4880a6f1ed ionice: fix typo
Signed-off-by: Pierre Hauweele <antegallya@gmail.com>
2010-03-14 22:58:56 +01:00
Jakob Unterwurzacher 5dc9371ce6 ionice: Allow setting the none class
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>
2009-05-27 23:43:18 +02:00
Karel Zak 357e7c3b2d ionice: change Jens Axboe's email
Based on
   util-linux-2.14.2-schedutils_fix_email.patch
from SUSE src.rpm package.

Signed-off-by: Karel Zak <kzak@redhat.com>
2009-04-23 13:22:27 +02:00
Karel Zak 030d18fd2a ionice: add strtol() checks, cleanup usage text and man page
* 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>
2008-09-06 14:54:01 +02:00
Stephan Maka ef0fe2e8aa ionice: let -p handle multiple PIDs
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>
2008-09-05 16:18:14 +02:00
Karel Zak 5bd11d0d11 ionice: cleanup error messages, add NLS support
Signed-off-by: Karel Zak <kzak@redhat.com>
2008-08-14 11:40:08 +02:00
Lubomir Kundrak 4d125dfc41 ionice: add -t option
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>
2008-06-16 13:08:51 +02:00
Mike Frysinger 72065909cc build-sys: unify method for checking system calls and fallback handling
Co-Author: Stepan Kasal <skasal@redhat.com>
Signed-off-by: Mike Frysinger <vapier@gentoo.org>
Signed-off-by: Stepan Kasal <skasal@redhat.com>
2007-09-20 00:22:22 +02:00
Matthias Koenig 2b25841371 ionice: clean up error handling
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>
2007-08-27 23:58:05 +02:00
Matthias Koenig 8dbfe5a1fe ionice: cleanup usage for idle class
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>
2007-07-25 16:44:17 +02:00
Karel Zak 4dfadf9c3a ionice: prefer SYS_ioprio_{set,get} from glibc to hardcoded version
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>
2007-07-16 12:22:54 +02:00
David Miller eba338783e ionice: fix ionice build on sparc
Provide the proper syscall numbers for this architecture.

Signed-off-by: David S. Miller <davem@davemloft.net>
2007-07-02 13:52:41 +02:00
Karel Zak 48d7b13a1e Imported from util-linux-2.13-pre1 tarball. 2006-12-07 00:26:54 +01:00