Commit 693ccaab authored by Randolph Chung's avatar Randolph Chung Committed by Richard Henderson

[PATCH] {get,set}affinity unification

This one gets rid of sys32_{get,set}affinity in favor of a unified
compat implementation.
parent 8a9e7331
...@@ -439,8 +439,8 @@ ia32_syscall_table: ...@@ -439,8 +439,8 @@ ia32_syscall_table:
data8 sys_ni_syscall data8 sys_ni_syscall
data8 sys_ni_syscall data8 sys_ni_syscall
data8 compat_sys_futex /* 240 */ data8 compat_sys_futex /* 240 */
data8 sys_ni_syscall data8 compat_sys_setaffinity
data8 sys_ni_syscall data8 compat_sys_getaffinity
data8 sys_ni_syscall data8 sys_ni_syscall
data8 sys_ni_syscall data8 sys_ni_syscall
data8 sys_ni_syscall /* 245 */ data8 sys_ni_syscall /* 245 */
......
...@@ -598,8 +598,8 @@ sys_call_table: ...@@ -598,8 +598,8 @@ sys_call_table:
ENTRY_SAME(sendfile64) ENTRY_SAME(sendfile64)
ENTRY_COMP(futex) /* 210 */ ENTRY_COMP(futex) /* 210 */
ENTRY_SAME(sched_setaffinity) ENTRY_COMP(sched_setaffinity)
ENTRY_SAME(sched_getaffinity) ENTRY_COMP(sched_getaffinity)
ENTRY_SAME(ni_syscall) ENTRY_SAME(ni_syscall)
ENTRY_SAME(ni_syscall) ENTRY_SAME(ni_syscall)
ENTRY_SAME(io_setup) /* 215 */ ENTRY_SAME(io_setup) /* 215 */
......
...@@ -724,8 +724,8 @@ _GLOBAL(sys_call_table32) ...@@ -724,8 +724,8 @@ _GLOBAL(sys_call_table32)
.llong .sys_lremovexattr .llong .sys_lremovexattr
.llong .sys_fremovexattr /* 220 */ .llong .sys_fremovexattr /* 220 */
.llong .compat_sys_futex .llong .compat_sys_futex
.llong .sys32_sched_setaffinity .llong .compat_sys_sched_setaffinity
.llong .sys32_sched_getaffinity .llong .compat_sys_sched_getaffinity
.llong .sys_ni_syscall .llong .sys_ni_syscall
.llong .sys_ni_syscall /* 225 - reserved for tux */ .llong .sys_ni_syscall /* 225 - reserved for tux */
.llong .sys32_sendfile64 .llong .sys32_sendfile64
......
...@@ -2780,56 +2780,6 @@ asmlinkage long sys32_time(compat_time_t* tloc) ...@@ -2780,56 +2780,6 @@ asmlinkage long sys32_time(compat_time_t* tloc)
return secs; return secs;
} }
extern asmlinkage long sys_sched_setaffinity(pid_t pid, unsigned int len,
unsigned long *user_mask_ptr);
asmlinkage long sys32_sched_setaffinity(compat_pid_t pid, unsigned int len,
u32 *user_mask_ptr)
{
unsigned long kernel_mask;
mm_segment_t old_fs;
int ret;
if (get_user(kernel_mask, user_mask_ptr))
return -EFAULT;
old_fs = get_fs();
set_fs(KERNEL_DS);
ret = sys_sched_setaffinity(pid,
/* XXX Nice api... */
sizeof(kernel_mask),
&kernel_mask);
set_fs(old_fs);
return ret;
}
extern asmlinkage long sys_sched_getaffinity(pid_t pid, unsigned int len,
unsigned long *user_mask_ptr);
asmlinkage long sys32_sched_getaffinity(compat_pid_t pid, unsigned int len,
u32 *user_mask_ptr)
{
unsigned long kernel_mask;
mm_segment_t old_fs;
int ret;
old_fs = get_fs();
set_fs(KERNEL_DS);
ret = sys_sched_getaffinity(pid,
/* XXX Nice api... */
sizeof(kernel_mask),
&kernel_mask);
set_fs(old_fs);
if (ret > 0) {
if (put_user(kernel_mask, user_mask_ptr))
ret = -EFAULT;
}
return ret;
}
int sys32_olduname(struct oldold_utsname * name) int sys32_olduname(struct oldold_utsname * name)
{ {
int error; int error;
......
...@@ -2831,56 +2831,6 @@ asmlinkage long sys32_sysctl(struct __sysctl_args32 *args) ...@@ -2831,56 +2831,6 @@ asmlinkage long sys32_sysctl(struct __sysctl_args32 *args)
return error; return error;
} }
extern asmlinkage long sys_sched_setaffinity(pid_t pid, unsigned int len,
unsigned long *user_mask_ptr);
asmlinkage long sys32_sched_setaffinity(compat_pid_t pid, unsigned int len,
u32 *user_mask_ptr)
{
unsigned long kernel_mask;
mm_segment_t old_fs;
int ret;
if (get_user(kernel_mask, user_mask_ptr))
return -EFAULT;
old_fs = get_fs();
set_fs(KERNEL_DS);
ret = sys_sched_setaffinity(pid,
/* XXX Nice api... */
sizeof(kernel_mask),
&kernel_mask);
set_fs(old_fs);
return ret;
}
extern asmlinkage long sys_sched_getaffinity(pid_t pid, unsigned int len,
unsigned long *user_mask_ptr);
asmlinkage long sys32_sched_getaffinity(compat_pid_t pid, unsigned int len,
u32 *user_mask_ptr)
{
unsigned long kernel_mask;
mm_segment_t old_fs;
int ret;
old_fs = get_fs();
set_fs(KERNEL_DS);
ret = sys_sched_getaffinity(pid,
/* XXX Nice api... */
sizeof(kernel_mask),
&kernel_mask);
set_fs(old_fs);
if (ret > 0) {
if (put_user(kernel_mask, user_mask_ptr))
ret = -EFAULT;
}
return ret;
}
extern long sys_lookup_dcookie(u64 cookie64, char *buf, size_t len); extern long sys_lookup_dcookie(u64 cookie64, char *buf, size_t len);
long sys32_lookup_dcookie(u32 cookie_high, u32 cookie_low, char *buf, size_t len) long sys32_lookup_dcookie(u32 cookie_high, u32 cookie_low, char *buf, size_t len)
......
...@@ -51,7 +51,7 @@ sys_call_table32: ...@@ -51,7 +51,7 @@ sys_call_table32:
.word sys32_setrlimit, sys_pivot_root, sys32_prctl, sys32_pciconfig_read, sys32_pciconfig_write .word sys32_setrlimit, sys_pivot_root, sys32_prctl, sys32_pciconfig_read, sys32_pciconfig_write
/*150*/ .word sys_nis_syscall, sys_nis_syscall, sys_nis_syscall, sys_poll, sys_getdents64 /*150*/ .word sys_nis_syscall, sys_nis_syscall, sys_nis_syscall, sys_poll, sys_getdents64
.word compat_sys_fcntl64, sys_ni_syscall, compat_sys_statfs, compat_sys_fstatfs, sys_oldumount .word compat_sys_fcntl64, sys_ni_syscall, compat_sys_statfs, compat_sys_fstatfs, sys_oldumount
/*160*/ .word sys32_sched_setaffinity, sys32_sched_getaffinity, sys_getdomainname, sys_setdomainname, sys_nis_syscall /*160*/ .word compat_sys_sched_setaffinity, compat_sys_sched_getaffinity, sys_getdomainname, sys_setdomainname, sys_nis_syscall
.word sys_quotactl, sys_set_tid_address, sys32_mount, sys_ustat, sys_setxattr .word sys_quotactl, sys_set_tid_address, sys32_mount, sys_ustat, sys_setxattr
/*170*/ .word sys_lsetxattr, sys_fsetxattr, sys_getxattr, sys_lgetxattr, sys32_getdents /*170*/ .word sys_lsetxattr, sys_fsetxattr, sys_getxattr, sys_lgetxattr, sys32_getdents
.word sys_setsid, sys_fchdir, sys_fgetxattr, sys_listxattr, sys_llistxattr .word sys_setsid, sys_fchdir, sys_fgetxattr, sys_listxattr, sys_llistxattr
......
...@@ -445,8 +445,8 @@ ia32_sys_call_table: ...@@ -445,8 +445,8 @@ ia32_sys_call_table:
.quad sys_tkill /* 238 */ .quad sys_tkill /* 238 */
.quad sys_sendfile64 .quad sys_sendfile64
.quad compat_sys_futex /* 240 */ .quad compat_sys_futex /* 240 */
.quad sys32_sched_setaffinity .quad compat_sys_sched_setaffinity
.quad sys32_sched_getaffinity .quad compat_sys_sched_getaffinity
.quad sys32_set_thread_area .quad sys32_set_thread_area
.quad sys32_get_thread_area .quad sys32_get_thread_area
.quad sys32_io_setup .quad sys32_io_setup
......
...@@ -2038,41 +2038,6 @@ long sys32_module_warning(void) ...@@ -2038,41 +2038,6 @@ long sys32_module_warning(void)
return -ENOSYS ; return -ENOSYS ;
} }
long sys_sched_getaffinity(pid_t pid, unsigned int len, unsigned long *new_mask_ptr);
long sys_sched_setaffinity(pid_t pid, unsigned int len, unsigned long *new_mask_ptr);
/* only works on LE */
long sys32_sched_setaffinity(pid_t pid, unsigned int len,
unsigned int *new_mask_ptr)
{
mm_segment_t oldfs = get_fs();
unsigned long mask;
int err;
if (get_user(mask, new_mask_ptr))
return -EFAULT;
set_fs(KERNEL_DS);
err = sys_sched_setaffinity(pid,sizeof(mask),&mask);
set_fs(oldfs);
return err;
}
/* only works on LE */
long sys32_sched_getaffinity(pid_t pid, unsigned int len,
unsigned int *new_mask_ptr)
{
mm_segment_t oldfs = get_fs();
unsigned long mask;
int err;
mask = 0;
set_fs(KERNEL_DS);
err = sys_sched_getaffinity(pid,sizeof(mask),&mask);
set_fs(oldfs);
if (err > 0)
err = put_user((u32)mask, new_mask_ptr);
return err;
}
extern long sys_io_setup(unsigned nr_reqs, aio_context_t *ctx); extern long sys_io_setup(unsigned nr_reqs, aio_context_t *ctx);
long sys32_io_setup(unsigned nr_reqs, u32 *ctx32p) long sys32_io_setup(unsigned nr_reqs, u32 *ctx32p)
......
...@@ -226,3 +226,54 @@ asmlinkage long compat_sys_futex(u32 *uaddr, int op, int val, ...@@ -226,3 +226,54 @@ asmlinkage long compat_sys_futex(u32 *uaddr, int op, int val,
} }
return do_futex((unsigned long)uaddr, op, val, timeout); return do_futex((unsigned long)uaddr, op, val, timeout);
} }
extern asmlinkage long sys_sched_setaffinity(pid_t pid, unsigned int len,
unsigned long *user_mask_ptr);
asmlinkage long compat_sys_sched_setaffinity(compat_pid_t pid,
unsigned int len,
compat_ulong_t *user_mask_ptr)
{
unsigned long kernel_mask;
mm_segment_t old_fs;
int ret;
if (get_user(kernel_mask, user_mask_ptr))
return -EFAULT;
old_fs = get_fs();
set_fs(KERNEL_DS);
ret = sys_sched_setaffinity(pid,
sizeof(kernel_mask),
&kernel_mask);
set_fs(old_fs);
return ret;
}
extern asmlinkage long sys_sched_getaffinity(pid_t pid, unsigned int len,
unsigned long *user_mask_ptr);
asmlinkage int compat_sys_sched_getaffinity(compat_pid_t pid, unsigned int len,
compat_ulong_t *user_mask_ptr)
{
unsigned long kernel_mask;
mm_segment_t old_fs;
int ret;
old_fs = get_fs();
set_fs(KERNEL_DS);
ret = sys_sched_getaffinity(pid,
sizeof(kernel_mask),
&kernel_mask);
set_fs(old_fs);
if (ret > 0) {
if (put_user(kernel_mask, user_mask_ptr))
ret = -EFAULT;
ret = sizeof(compat_ulong_t);
}
return ret;
}
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