From: Matt Mackall Date: Thu, 18 Aug 2005 18:24:19 +0000 (-0700) Subject: [PATCH] Make RLIMIT_NICE ranges consistent with getpriority(2) X-Git-Tag: v2.6.13-rc7~59^2~27 X-Git-Url: http://pilppa.com/gitweb/?a=commitdiff_plain;h=024f474795af7a0d41bd6d60061d78bd66d13f56;p=linux-2.6-omap-h63xx.git [PATCH] Make RLIMIT_NICE ranges consistent with getpriority(2) As suggested by Michael Kerrisk , make RLIMIT_NICE consistent with getpriority before it becomes available in released glibc. Signed-off-by: Matt Mackall Acked-by: Ingo Molnar Acked-by: Chris Wright Signed-off-by: Andrew Morton Signed-off-by: Linus Torvalds --- diff --git a/kernel/sched.c b/kernel/sched.c index a646e4f36c4..5f889d0cbfc 100644 --- a/kernel/sched.c +++ b/kernel/sched.c @@ -3378,8 +3378,8 @@ EXPORT_SYMBOL(set_user_nice); */ int can_nice(const task_t *p, const int nice) { - /* convert nice value [19,-20] to rlimit style value [0,39] */ - int nice_rlim = 19 - nice; + /* convert nice value [19,-20] to rlimit style value [1,40] */ + int nice_rlim = 20 - nice; return (nice_rlim <= p->signal->rlim[RLIMIT_NICE].rlim_cur || capable(CAP_SYS_NICE)); }