提交 3e88c553 编写于 作者: D Daniel Walker 提交者: Linus Torvalds

use defines in sys_getpriority/sys_setpriority

Switch to the defines for these two checks, instead of hard coding the
values.

[akpm@linux-foundation.org: add missing include]
Signed-off-by: NDaniel Walker <dwalker@mvista.com>
Cc: Ingo Molnar <mingo@elte.hu>
Signed-off-by: NAndrew Morton <akpm@linux-foundation.org>
Signed-off-by: NLinus Torvalds <torvalds@linux-foundation.org>
上级 00b8fd23
...@@ -14,6 +14,7 @@ ...@@ -14,6 +14,7 @@
#include <linux/prctl.h> #include <linux/prctl.h>
#include <linux/highuid.h> #include <linux/highuid.h>
#include <linux/fs.h> #include <linux/fs.h>
#include <linux/resource.h>
#include <linux/kernel.h> #include <linux/kernel.h>
#include <linux/kexec.h> #include <linux/kexec.h>
#include <linux/workqueue.h> #include <linux/workqueue.h>
...@@ -659,7 +660,7 @@ asmlinkage long sys_setpriority(int which, int who, int niceval) ...@@ -659,7 +660,7 @@ asmlinkage long sys_setpriority(int which, int who, int niceval)
int error = -EINVAL; int error = -EINVAL;
struct pid *pgrp; struct pid *pgrp;
if (which > 2 || which < 0) if (which > PRIO_USER || which < PRIO_PROCESS)
goto out; goto out;
/* normalize: avoid signed division (rounding problems) */ /* normalize: avoid signed division (rounding problems) */
...@@ -723,7 +724,7 @@ asmlinkage long sys_getpriority(int which, int who) ...@@ -723,7 +724,7 @@ asmlinkage long sys_getpriority(int which, int who)
long niceval, retval = -ESRCH; long niceval, retval = -ESRCH;
struct pid *pgrp; struct pid *pgrp;
if (which > 2 || which < 0) if (which > PRIO_USER || which < PRIO_PROCESS)
return -EINVAL; return -EINVAL;
read_lock(&tasklist_lock); read_lock(&tasklist_lock);
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册