aboutsummaryrefslogtreecommitdiffstats
path: root/kernel
diff options
context:
space:
mode:
authorMatt Mackall <mpm@selenic.com>2005-08-18 14:24:19 -0400
committerLinus Torvalds <torvalds@g5.osdl.org>2005-08-18 15:53:58 -0400
commit024f474795af7a0d41bd6d60061d78bd66d13f56 (patch)
tree41dd079483713c7669b4c684686de3b701362d34 /kernel
parent6cbe9de7a4353d1a1b77887b5459ac5304c0984a (diff)
[PATCH] Make RLIMIT_NICE ranges consistent with getpriority(2)
As suggested by Michael Kerrisk <mtk-manpages@gmx.net>, make RLIMIT_NICE consistent with getpriority before it becomes available in released glibc. Signed-off-by: Matt Mackall <mpm@selenic.com> Acked-by: Ingo Molnar <mingo@elte.hu> Acked-by: Chris Wright <chrisw@osdl.org> Signed-off-by: Andrew Morton <akpm@osdl.org> Signed-off-by: Linus Torvalds <torvalds@osdl.org>
Diffstat (limited to 'kernel')
-rw-r--r--kernel/sched.c4
1 files changed, 2 insertions, 2 deletions
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);
3378 */ 3378 */
3379int can_nice(const task_t *p, const int nice) 3379int can_nice(const task_t *p, const int nice)
3380{ 3380{
3381 /* convert nice value [19,-20] to rlimit style value [0,39] */ 3381 /* convert nice value [19,-20] to rlimit style value [1,40] */
3382 int nice_rlim = 19 - nice; 3382 int nice_rlim = 20 - nice;
3383 return (nice_rlim <= p->signal->rlim[RLIMIT_NICE].rlim_cur || 3383 return (nice_rlim <= p->signal->rlim[RLIMIT_NICE].rlim_cur ||
3384 capable(CAP_SYS_NICE)); 3384 capable(CAP_SYS_NICE));
3385} 3385}