Commit 6d35ab48 authored by Peter Zijlstra's avatar Peter Zijlstra Committed by Thomas Gleixner

sched: Add 'flags' argument to sched_{set,get}attr() syscalls

Because of a recent syscall design debate; its deemed appropriate for
each syscall to have a flags argument for future extension; without
immediately requiring new syscalls.

Cc: juri.lelli@gmail.com
Cc: Ingo Molnar <mingo@redhat.com>
Suggested-by: default avatarMichael Kerrisk <mtk.manpages@gmail.com>
Signed-off-by: default avatarPeter Zijlstra <peterz@infradead.org>
Link: http://lkml.kernel.org/r/20140214161929.GL27965@twins.programming.kicks-ass.netSigned-off-by: default avatarThomas Gleixner <tglx@linutronix.de>
parent 4efbc454
...@@ -281,13 +281,15 @@ asmlinkage long sys_sched_setscheduler(pid_t pid, int policy, ...@@ -281,13 +281,15 @@ asmlinkage long sys_sched_setscheduler(pid_t pid, int policy,
asmlinkage long sys_sched_setparam(pid_t pid, asmlinkage long sys_sched_setparam(pid_t pid,
struct sched_param __user *param); struct sched_param __user *param);
asmlinkage long sys_sched_setattr(pid_t pid, asmlinkage long sys_sched_setattr(pid_t pid,
struct sched_attr __user *attr); struct sched_attr __user *attr,
unsigned int flags);
asmlinkage long sys_sched_getscheduler(pid_t pid); asmlinkage long sys_sched_getscheduler(pid_t pid);
asmlinkage long sys_sched_getparam(pid_t pid, asmlinkage long sys_sched_getparam(pid_t pid,
struct sched_param __user *param); struct sched_param __user *param);
asmlinkage long sys_sched_getattr(pid_t pid, asmlinkage long sys_sched_getattr(pid_t pid,
struct sched_attr __user *attr, struct sched_attr __user *attr,
unsigned int size); unsigned int size,
unsigned int flags);
asmlinkage long sys_sched_setaffinity(pid_t pid, unsigned int len, asmlinkage long sys_sched_setaffinity(pid_t pid, unsigned int len,
unsigned long __user *user_mask_ptr); unsigned long __user *user_mask_ptr);
asmlinkage long sys_sched_getaffinity(pid_t pid, unsigned int len, asmlinkage long sys_sched_getaffinity(pid_t pid, unsigned int len,
......
...@@ -3661,13 +3661,14 @@ SYSCALL_DEFINE2(sched_setparam, pid_t, pid, struct sched_param __user *, param) ...@@ -3661,13 +3661,14 @@ SYSCALL_DEFINE2(sched_setparam, pid_t, pid, struct sched_param __user *, param)
* @pid: the pid in question. * @pid: the pid in question.
* @uattr: structure containing the extended parameters. * @uattr: structure containing the extended parameters.
*/ */
SYSCALL_DEFINE2(sched_setattr, pid_t, pid, struct sched_attr __user *, uattr) SYSCALL_DEFINE3(sched_setattr, pid_t, pid, struct sched_attr __user *, uattr,
unsigned int, flags)
{ {
struct sched_attr attr; struct sched_attr attr;
struct task_struct *p; struct task_struct *p;
int retval; int retval;
if (!uattr || pid < 0) if (!uattr || pid < 0 || flags)
return -EINVAL; return -EINVAL;
if (sched_copy_attr(uattr, &attr)) if (sched_copy_attr(uattr, &attr))
...@@ -3804,8 +3805,8 @@ static int sched_read_attr(struct sched_attr __user *uattr, ...@@ -3804,8 +3805,8 @@ static int sched_read_attr(struct sched_attr __user *uattr,
* @uattr: structure containing the extended parameters. * @uattr: structure containing the extended parameters.
* @size: sizeof(attr) for fwd/bwd comp. * @size: sizeof(attr) for fwd/bwd comp.
*/ */
SYSCALL_DEFINE3(sched_getattr, pid_t, pid, struct sched_attr __user *, uattr, SYSCALL_DEFINE4(sched_getattr, pid_t, pid, struct sched_attr __user *, uattr,
unsigned int, size) unsigned int, size, unsigned int, flags)
{ {
struct sched_attr attr = { struct sched_attr attr = {
.size = sizeof(struct sched_attr), .size = sizeof(struct sched_attr),
...@@ -3814,7 +3815,7 @@ SYSCALL_DEFINE3(sched_getattr, pid_t, pid, struct sched_attr __user *, uattr, ...@@ -3814,7 +3815,7 @@ SYSCALL_DEFINE3(sched_getattr, pid_t, pid, struct sched_attr __user *, uattr,
int retval; int retval;
if (!uattr || pid < 0 || size > PAGE_SIZE || if (!uattr || pid < 0 || size > PAGE_SIZE ||
size < SCHED_ATTR_SIZE_VER0) size < SCHED_ATTR_SIZE_VER0 || flags)
return -EINVAL; return -EINVAL;
rcu_read_lock(); rcu_read_lock();
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment