util-linux-ng/util-linux-ng-2.14-renice-n.patch
kzak 24912fbd9d - fix #489672 - flock segfaults when file name is not given (upstream)
- fix #476964 - Mount /var/tmp with tmpfs creates denials
- fix #487227 - fdisk 4KiB hw sectors support (upstream)
- fix #477303 - renice doesn't support -n option (upstream)
2009-03-19 10:11:58 +00:00

83 lines
2.1 KiB
Diff

From 7cfbafda9c484a8cadefc47ee115086e803d9391 Mon Sep 17 00:00:00 2001
From: Karel Zak <kzak@redhat.com>
Date: Mon, 9 Mar 2009 21:09:50 +0100
Subject: [PATCH] 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>
---
sys-utils/renice.1 | 7 ++++++-
sys-utils/renice.c | 12 +++++++++---
2 files changed, 15 insertions(+), 4 deletions(-)
diff --git a/sys-utils/renice.1 b/sys-utils/renice.1
index 3c20d6e..32a23e1 100644
--- a/sys-utils/renice.1
+++ b/sys-utils/renice.1
@@ -29,7 +29,7 @@
.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
.\" SUCH DAMAGE.
.\"
-.\" @(#)renice.8 8.1 (Berkeley) 6/9/93
+.\" @(#)renice.8 8.1 (Berkeley) 6/9/93
.\"
.Dd June 9, 1993
.Dt RENICE 1
@@ -39,6 +39,7 @@
.Nd alter priority of running processes
.Sh SYNOPSIS
.Nm renice
+.Op Fl n
.Ar priority
.Oo
.Op Fl p
@@ -74,6 +75,10 @@ their process ID's.
Options supported by
.Nm renice :
.Bl -tag -width Ds
+.It Fl n, Fl Fl priority
+The scheduling
+.Ar priority
+of the process, process group, or user.
.It Fl g, Fl Fl pgrp
Force
.Ar who
diff --git a/sys-utils/renice.c b/sys-utils/renice.c
index ac05d25..879e8bd 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);
--
1.6.0.6