summaryrefslogtreecommitdiffstats
path: root/sys-utils/renice.c
diff options
context:
space:
mode:
authorKarel Zak2009-03-09 21:09:50 +0100
committerKarel Zak2009-03-09 21:09:50 +0100
commit7cfbafda9c484a8cadefc47ee115086e803d9391 (patch)
tree657c25da4d0ee53f487835593050877cbdc00e2e /sys-utils/renice.c
parentbuild-sys: cleanup --with-fsprobe help string (diff)
downloadkernel-qcow2-util-linux-7cfbafda9c484a8cadefc47ee115086e803d9391.tar.gz
kernel-qcow2-util-linux-7cfbafda9c484a8cadefc47ee115086e803d9391.tar.xz
kernel-qcow2-util-linux-7cfbafda9c484a8cadefc47ee115086e803d9391.zip
renice: add -n option for compatibility with POSIX
The -n option is required by POSIX.1-200x. Signed-off-by: Karel Zak <kzak@redhat.com>
Diffstat (limited to 'sys-utils/renice.c')
-rw-r--r--sys-utils/renice.c12
1 files changed, 9 insertions, 3 deletions
diff --git a/sys-utils/renice.c b/sys-utils/renice.c
index ac05d2587..879e8bd91 100644
--- a/sys-utils/renice.c
+++ b/sys-utils/renice.c
@@ -51,14 +51,15 @@ int donice(int,int,int);
void usage(int rc)
{
printf( _("\nUsage:\n"
- " renice priority [-p|--pid] pid [... pid]\n"
- " renice priority -g|--pgrp pgrp [... pgrp]\n"
- " renice priority -u|--user user [... user]\n"
+ " renice [-n] priority [-p|--pid] pid [... pid]\n"
+ " renice [-n] priority -g|--pgrp pgrp [... pgrp]\n"
+ " renice [-n] priority -u|--user user [... user]\n"
" renice -h | --help\n"
" renice -v | --version\n\n"));
exit(rc);
}
+
/*
* Change the priority (nice) of processes
* or groups of processes which are already
@@ -93,6 +94,11 @@ main(int argc, char **argv)
if (argc < 2)
usage(EXIT_FAILURE);
+ if (strcmp(*argv, "-n") == 0 || strcmp(*argv, "--priority") == 0) {
+ argc--;
+ argv++;
+ }
+
prio = strtol(*argv, &endptr, 10);
if (*endptr)
usage(EXIT_FAILURE);