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-Url: https://git.stricted.de/?a=commitdiff_plain;h=024f474795af7a0d41bd6d60061d78bd66d13f56;p=GitHub%2FLineageOS%2Fandroid_kernel_samsung_universal7580.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)); }