summaryrefslogtreecommitdiffstats
path: root/sys-utils/renice.c
Commit message (Collapse)AuthorAgeFilesLines
* renice: make code more readable for static analyzer [coverity scan]Karel Zak2019-05-281-1/+1
| | | | | | | It seems coverity and clag have no clue about relation between argv[] and argc. Let's make code more readable for them... Signed-off-by: Karel Zak <kzak@redhat.com>
* misc: consolidate version printing and close_stdout()Karel Zak2019-04-161-5/+3Star
| | | | Signed-off-by: Karel Zak <kzak@redhat.com>
* Fix minor typo: priorty -> priorityYuri Chornoivan2017-12-311-1/+1
|
* 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: cleanup and fix --unknownopt issuesRuediger Meier2017-06-261-8/+12
| | | | | | | | | | | | | | | | Fixed checkusage.sh warnings: rtcwake: --unknownopt, non-empty stdout rtcwake: --unknownopt, stderr too long: 21 blockdev: --unknownopt, stderr too long: 28 lsipc: --unknownopt, stderr too long: 77 pg: --unknownopt, stderr too long: 23 renice: --unknownopt, stderr too long: 18 sulogin: --unknownopt, stderr too long: 17 write: --unknownopt, stderr too long: 12 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>
* textual: add a docstring to most of the utilitiesBenno Schulenberg2015-01-061-0/+4
| | | | | | | | | 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: use angular brackets around each individual argumentBenno Schulenberg2014-10-011-1/+3
| | | | | | | In usage texts each word that is an argument should be marked separately with angular brackets. Also add a translator comment. Signed-off-by: Benno Schulenberg <bensberg@justemail.net>
* renice: reorder usage() option descriptionsSami Kerola2014-09-191-6/+7
| | | | | | | Make the Usage: and Options: sections to be in same order, which I found to be quicker to use than alphabetical order. Signed-off-by: Sami Kerola <kerolasa@iki.fi>
* rename: add getpriority() message lookup tableSami Kerola2014-09-191-13/+14
| | | | Signed-off-by: Sami Kerola <kerolasa@iki.fi>
* renice: fix numeric uid argument parsingSami Kerola2014-09-191-4/+6
| | | | | | | | | | | | | The following was inconflict with what usage() tells are valid option arguments. $ renice 1 -u 1000 renice: unknown user 1000 $ id uid=1000(kerolasa) ... Reviewed-by: Karel Zak <kzak@redhat.com> Signed-off-by: Sami Kerola <kerolasa@iki.fi>
* renice: avoid having same lines of code twiceSami Kerola2014-09-191-16/+16
| | | | | | | Add getprio() function to avoid duplication of a simple task. Reviewed-by: Karel Zak <kzak@redhat.com> Signed-off-by: Sami Kerola <kerolasa@iki.fi>
* renice: disallow --priority <arg> without pid argumentSami Kerola2014-09-191-4/+4
| | | | | | | | | | Earlier a lonely priority with an argument but without pid resulted to no action and success, when the invocation should have failed. $ renice --priority 42 ; echo $? 0 Signed-off-by: Sami Kerola <kerolasa@iki.fi>
* rename: use usage and version print out macrosSami Kerola2014-09-191-9/+5Star
| | | | Signed-off-by: Sami Kerola <kerolasa@iki.fi>
* renice: reorder functions to avoid need of function prototypeSami Kerola2014-09-191-33/+32Star
| | | | Signed-off-by: Sami Kerola <kerolasa@iki.fi>
* renice: exit with non-zero value when arguments cause warningsSami Kerola2013-07-011-1/+3
| | | | | | | | This commit also fixes potential error counter wrap, which theoretically could make command to exit with a success when it internally failed just correct amount of times. Signed-off-by: Sami Kerola <kerolasa@iki.fi>
* textual: spell and encode the name of Arkadiusz Miƛkiewicz correctlyBenno Schulenberg2013-02-061-1/+1
| | | | Signed-off-by: Benno Schulenberg <bensberg@justemail.net>
* renice: accept also -V for --version, and document itBenno Schulenberg2013-01-251-5/+6
| | | | | | Also improve the man page. Signed-off-by: Benno Schulenberg <bensberg@justemail.net>
* renice: correct the usage synopsis, and improve help textBenno Schulenberg2013-01-251-9/+9
| | | | Signed-off-by: Benno Schulenberg <bensberg@justemail.net>
* sys-utils: verify writing to streams was successfulSami Kerola2012-04-041-0/+2
| | | | Signed-off-by: Sami Kerola <kerolasa@iki.fi>
* renice: cleanup usage()Karel Zak2011-08-161-8/+7Star
| | | | Signed-off-by: Karel Zak <kzak@redhat.com>
* build-sys: provide alternatives for err, errx, warn and warnxFabian Groffen2011-02-141-1/+1
| | | | | | | | 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>
* fix __noreturn__ usageKarel Zak2010-12-101-1/+1
| | | | Signed-off-by: Karel Zak <kzak@redhat.com>
* renice: improve messages specifying what ID is referring toFrancesco Cosoleto2010-12-091-5/+11
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Hello, On 30/11/2010 13:01, Karel Zak wrote: > Unfortunately, translators don't like this kind of strings where any > translatable substring is inserted to the normal sentence. It would be > better to use something like: > > "%d (%s): failed to set priority", who, idtype > > "%s: %d: failed to set priority", idtype, who > > or so... or "failed to set priority for %d (%s)"? From 536eb11f873f2c887e075a37ffb3c971cac258d5 Mon Sep 17 00:00:00 2001 From: Francesco Cosoleto <cosoleto@gmail.com> Date: Mon, 6 Dec 2010 01:23:10 +0100 Subject: [PATCH] renice: improve messages specifying what ID is referring to This version makes more clear the printed message specially when the --user option is used. Old version: $ renice 19 10 -u fra -g 1 renice: 10: setpriority: Operation not permitted renice: 1000: setpriority: Operation not permitted renice: 1: setpriority: Operation not permitted $ renice 19 -u fra 1000: old priority 0, new priority 19 New version: $ renice 19 10 -u fra -g 1 renice: failed to set priority for 10 (process ID): Operation not permitted renice: failed to set priority for 1000 (user ID): Operation not permitted renice: failed to set priority for 1 (process group ID): Operation not permitted $ renice 19 -u fra 1000 (user ID) old priority 0, new priority 19 Signed-off-by: Francesco Cosoleto <cosoleto@gmail.com>
* renice: rewrite usage()Karel Zak2010-11-301-12/+23
| | | | Signed-off-by: Karel Zak <kzak@redhat.com>
* renice: reverse %s position in error messagesFrancesco Cosoleto2010-11-301-2/+2
| | | | Signed-off-by: Francesco Cosoleto <cosoleto@gmail.com>
* renice: remove hardcoded program name using warn() and warnx()Francesco Cosoleto2010-11-301-10/+6Star
| | | | Signed-off-by: Francesco Cosoleto <cosoleto@gmail.com>
* renice: make some functions staticFrancesco Cosoleto2010-11-301-3/+3
|
* renice: add -n option for compatibility with POSIXKarel Zak2009-03-091-3/+9
| | | | | | The -n option is required by POSIX.1-200x. Signed-off-by: Karel Zak <kzak@redhat.com>
* renice: detect errors in arguments, add -v, -h and long optionsLaMont Jones2008-01-291-23/+46
| | | | | | | | | | | | | | | | | | * renice was using atoi(), which does no error detection, meaning that: "renice +20 blah" was accepted as valid. * add -h | --help * add -v | --version * add long options for -p, -u and -g * cleanup coding style Addresses-Debian-Bug: #385245 Co-Author: Karel Zak <kzak@redhat.com> Signed-off-by: LaMont Jones <lamont@debian.org> Signed-off-by: Karel Zak <kzak@redhat.com>
* Imported from util-linux-2.11m tarball.Karel Zak2006-12-071-7/+17
|
* Imported from util-linux-2.11b tarball.Karel Zak2006-12-071-1/+1
|
* Imported from util-linux-2.10s tarball.Karel Zak2006-12-071-0/+1
|
* Imported from util-linux-2.9v tarball.Karel Zak2006-12-071-8/+17
|
* Imported from util-linux-2.8 tarball.Karel Zak2006-12-071-14/+3Star
|
* Imported from util-linux-2.7.1 tarball.Karel Zak2006-12-071-0/+5
|
* Imported from util-linux-2.2 tarball.Karel Zak2006-12-071-0/+128