Commit 3158e941 authored by Stephen Rothwell's avatar Stephen Rothwell Committed by Linus Torvalds

[PATCH] consolidate sys32/compat_adjtimex

Create compat_sys_adjtimex and use it an all appropriate places.
Signed-off-by: default avatarStephen Rothwell <sfr@canb.auug.org.au>
Cc: Arnd Bergmann <arnd@arndb.de>
Acked-by: default avatarPaul Mackerras <paulus@samba.org>
Signed-off-by: default avatarAndrew Morton <akpm@osdl.org>
Signed-off-by: default avatarLinus Torvalds <torvalds@osdl.org>
parent 88959ea9
...@@ -821,7 +821,6 @@ osf_setsysinfo(unsigned long op, void __user *buffer, unsigned long nbytes, ...@@ -821,7 +821,6 @@ osf_setsysinfo(unsigned long op, void __user *buffer, unsigned long nbytes,
affects all sorts of things, like timeval and itimerval. */ affects all sorts of things, like timeval and itimerval. */
extern struct timezone sys_tz; extern struct timezone sys_tz;
extern int do_adjtimex(struct timex *);
struct timeval32 struct timeval32
{ {
......
...@@ -25,7 +25,6 @@ ...@@ -25,7 +25,6 @@
#include <linux/resource.h> #include <linux/resource.h>
#include <linux/times.h> #include <linux/times.h>
#include <linux/utsname.h> #include <linux/utsname.h>
#include <linux/timex.h>
#include <linux/smp.h> #include <linux/smp.h>
#include <linux/smp_lock.h> #include <linux/smp_lock.h>
#include <linux/sem.h> #include <linux/sem.h>
...@@ -2591,65 +2590,4 @@ sys32_setresgid(compat_gid_t rgid, compat_gid_t egid, ...@@ -2591,65 +2590,4 @@ sys32_setresgid(compat_gid_t rgid, compat_gid_t egid,
ssgid = (sgid == (compat_gid_t)-1) ? ((gid_t)-1) : ((gid_t)sgid); ssgid = (sgid == (compat_gid_t)-1) ? ((gid_t)-1) : ((gid_t)sgid);
return sys_setresgid(srgid, segid, ssgid); return sys_setresgid(srgid, segid, ssgid);
} }
/* Handle adjtimex compatibility. */
extern int do_adjtimex(struct timex *);
asmlinkage long
sys32_adjtimex(struct compat_timex *utp)
{
struct timex txc;
int ret;
memset(&txc, 0, sizeof(struct timex));
if(get_user(txc.modes, &utp->modes) ||
__get_user(txc.offset, &utp->offset) ||
__get_user(txc.freq, &utp->freq) ||
__get_user(txc.maxerror, &utp->maxerror) ||
__get_user(txc.esterror, &utp->esterror) ||
__get_user(txc.status, &utp->status) ||
__get_user(txc.constant, &utp->constant) ||
__get_user(txc.precision, &utp->precision) ||
__get_user(txc.tolerance, &utp->tolerance) ||
__get_user(txc.time.tv_sec, &utp->time.tv_sec) ||
__get_user(txc.time.tv_usec, &utp->time.tv_usec) ||
__get_user(txc.tick, &utp->tick) ||
__get_user(txc.ppsfreq, &utp->ppsfreq) ||
__get_user(txc.jitter, &utp->jitter) ||
__get_user(txc.shift, &utp->shift) ||
__get_user(txc.stabil, &utp->stabil) ||
__get_user(txc.jitcnt, &utp->jitcnt) ||
__get_user(txc.calcnt, &utp->calcnt) ||
__get_user(txc.errcnt, &utp->errcnt) ||
__get_user(txc.stbcnt, &utp->stbcnt))
return -EFAULT;
ret = do_adjtimex(&txc);
if(put_user(txc.modes, &utp->modes) ||
__put_user(txc.offset, &utp->offset) ||
__put_user(txc.freq, &utp->freq) ||
__put_user(txc.maxerror, &utp->maxerror) ||
__put_user(txc.esterror, &utp->esterror) ||
__put_user(txc.status, &utp->status) ||
__put_user(txc.constant, &utp->constant) ||
__put_user(txc.precision, &utp->precision) ||
__put_user(txc.tolerance, &utp->tolerance) ||
__put_user(txc.time.tv_sec, &utp->time.tv_sec) ||
__put_user(txc.time.tv_usec, &utp->time.tv_usec) ||
__put_user(txc.tick, &utp->tick) ||
__put_user(txc.ppsfreq, &utp->ppsfreq) ||
__put_user(txc.jitter, &utp->jitter) ||
__put_user(txc.shift, &utp->shift) ||
__put_user(txc.stabil, &utp->stabil) ||
__put_user(txc.jitcnt, &utp->jitcnt) ||
__put_user(txc.calcnt, &utp->calcnt) ||
__put_user(txc.errcnt, &utp->errcnt) ||
__put_user(txc.stbcnt, &utp->stbcnt))
ret = -EFAULT;
return ret;
}
#endif /* NOTYET */ #endif /* NOTYET */
...@@ -30,7 +30,6 @@ ...@@ -30,7 +30,6 @@
#include <linux/utime.h> #include <linux/utime.h>
#include <linux/utsname.h> #include <linux/utsname.h>
#include <linux/personality.h> #include <linux/personality.h>
#include <linux/timex.h>
#include <linux/dnotify.h> #include <linux/dnotify.h>
#include <linux/module.h> #include <linux/module.h>
#include <linux/binfmts.h> #include <linux/binfmts.h>
...@@ -1157,66 +1156,6 @@ out: ...@@ -1157,66 +1156,6 @@ out:
return err; return err;
} }
/* Handle adjtimex compatibility. */
extern int do_adjtimex(struct timex *);
asmlinkage int sys32_adjtimex(struct compat_timex __user *utp)
{
struct timex txc;
int ret;
memset(&txc, 0, sizeof(struct timex));
if (get_user(txc.modes, &utp->modes) ||
__get_user(txc.offset, &utp->offset) ||
__get_user(txc.freq, &utp->freq) ||
__get_user(txc.maxerror, &utp->maxerror) ||
__get_user(txc.esterror, &utp->esterror) ||
__get_user(txc.status, &utp->status) ||
__get_user(txc.constant, &utp->constant) ||
__get_user(txc.precision, &utp->precision) ||
__get_user(txc.tolerance, &utp->tolerance) ||
__get_user(txc.time.tv_sec, &utp->time.tv_sec) ||
__get_user(txc.time.tv_usec, &utp->time.tv_usec) ||
__get_user(txc.tick, &utp->tick) ||
__get_user(txc.ppsfreq, &utp->ppsfreq) ||
__get_user(txc.jitter, &utp->jitter) ||
__get_user(txc.shift, &utp->shift) ||
__get_user(txc.stabil, &utp->stabil) ||
__get_user(txc.jitcnt, &utp->jitcnt) ||
__get_user(txc.calcnt, &utp->calcnt) ||
__get_user(txc.errcnt, &utp->errcnt) ||
__get_user(txc.stbcnt, &utp->stbcnt))
return -EFAULT;
ret = do_adjtimex(&txc);
if (put_user(txc.modes, &utp->modes) ||
__put_user(txc.offset, &utp->offset) ||
__put_user(txc.freq, &utp->freq) ||
__put_user(txc.maxerror, &utp->maxerror) ||
__put_user(txc.esterror, &utp->esterror) ||
__put_user(txc.status, &utp->status) ||
__put_user(txc.constant, &utp->constant) ||
__put_user(txc.precision, &utp->precision) ||
__put_user(txc.tolerance, &utp->tolerance) ||
__put_user(txc.time.tv_sec, &utp->time.tv_sec) ||
__put_user(txc.time.tv_usec, &utp->time.tv_usec) ||
__put_user(txc.tick, &utp->tick) ||
__put_user(txc.ppsfreq, &utp->ppsfreq) ||
__put_user(txc.jitter, &utp->jitter) ||
__put_user(txc.shift, &utp->shift) ||
__put_user(txc.stabil, &utp->stabil) ||
__put_user(txc.jitcnt, &utp->jitcnt) ||
__put_user(txc.calcnt, &utp->calcnt) ||
__put_user(txc.errcnt, &utp->errcnt) ||
__put_user(txc.stbcnt, &utp->stbcnt))
ret = -EFAULT;
return ret;
}
asmlinkage int sys32_sendfile(int out_fd, int in_fd, compat_off_t __user *offset, asmlinkage int sys32_sendfile(int out_fd, int in_fd, compat_off_t __user *offset,
s32 count) s32 count)
{ {
......
...@@ -273,7 +273,7 @@ EXPORT(sysn32_call_table) ...@@ -273,7 +273,7 @@ EXPORT(sysn32_call_table)
PTR sys_pivot_root PTR sys_pivot_root
PTR sys32_sysctl PTR sys32_sysctl
PTR sys_prctl PTR sys_prctl
PTR sys32_adjtimex PTR compat_sys_adjtimex
PTR compat_sys_setrlimit /* 6155 */ PTR compat_sys_setrlimit /* 6155 */
PTR sys_chroot PTR sys_chroot
PTR sys_sync PTR sys_sync
......
...@@ -328,7 +328,7 @@ sys_call_table: ...@@ -328,7 +328,7 @@ sys_call_table:
PTR sys_setdomainname PTR sys_setdomainname
PTR sys32_newuname PTR sys32_newuname
PTR sys_ni_syscall /* sys_modify_ldt */ PTR sys_ni_syscall /* sys_modify_ldt */
PTR sys32_adjtimex PTR compat_sys_adjtimex
PTR sys_mprotect /* 4125 */ PTR sys_mprotect /* 4125 */
PTR compat_sys_sigprocmask PTR compat_sys_sigprocmask
PTR sys_ni_syscall /* was creat_module */ PTR sys_ni_syscall /* was creat_module */
......
...@@ -21,7 +21,6 @@ ...@@ -21,7 +21,6 @@
#include <linux/times.h> #include <linux/times.h>
#include <linux/utsname.h> #include <linux/utsname.h>
#include <linux/time.h> #include <linux/time.h>
#include <linux/timex.h>
#include <linux/smp.h> #include <linux/smp.h>
#include <linux/smp_lock.h> #include <linux/smp_lock.h>
#include <linux/sem.h> #include <linux/sem.h>
...@@ -567,34 +566,6 @@ asmlinkage int sys32_sendfile64(int out_fd, int in_fd, compat_loff_t __user *off ...@@ -567,34 +566,6 @@ asmlinkage int sys32_sendfile64(int out_fd, int in_fd, compat_loff_t __user *off
} }
asmlinkage long sys32_adjtimex(struct compat_timex __user *txc_p32)
{
struct timex txc;
struct compat_timex t32;
int ret;
extern int do_adjtimex(struct timex *txc);
if(copy_from_user(&t32, txc_p32, sizeof(struct compat_timex)))
return -EFAULT;
#undef CP
#define CP(x) txc.x = t32.x
CP(modes); CP(offset); CP(freq); CP(maxerror); CP(esterror);
CP(status); CP(constant); CP(precision); CP(tolerance);
CP(time.tv_sec); CP(time.tv_usec); CP(tick); CP(ppsfreq); CP(jitter);
CP(shift); CP(stabil); CP(jitcnt); CP(calcnt); CP(errcnt);
CP(stbcnt);
ret = do_adjtimex(&txc);
#undef CP
#define CP(x) t32.x = txc.x
CP(modes); CP(offset); CP(freq); CP(maxerror); CP(esterror);
CP(status); CP(constant); CP(precision); CP(tolerance);
CP(time.tv_sec); CP(time.tv_usec); CP(tick); CP(ppsfreq); CP(jitter);
CP(shift); CP(stabil); CP(jitcnt); CP(calcnt); CP(errcnt);
CP(stbcnt);
return copy_to_user(txc_p32, &t32, sizeof(struct compat_timex)) ? -EFAULT : ret;
}
struct sysinfo32 { struct sysinfo32 {
s32 uptime; s32 uptime;
u32 loads[3]; u32 loads[3];
......
...@@ -207,7 +207,7 @@ ...@@ -207,7 +207,7 @@
/* struct sockaddr... */ /* struct sockaddr... */
ENTRY_SAME(recvfrom) ENTRY_SAME(recvfrom)
/* struct timex contains longs */ /* struct timex contains longs */
ENTRY_DIFF(adjtimex) ENTRY_COMP(adjtimex)
ENTRY_SAME(mprotect) /* 125 */ ENTRY_SAME(mprotect) /* 125 */
/* old_sigset_t forced to 32 bits. Beware glibc sigset_t */ /* old_sigset_t forced to 32 bits. Beware glibc sigset_t */
ENTRY_COMP(sigprocmask) ENTRY_COMP(sigprocmask)
......
...@@ -24,7 +24,6 @@ ...@@ -24,7 +24,6 @@
#include <linux/resource.h> #include <linux/resource.h>
#include <linux/times.h> #include <linux/times.h>
#include <linux/utsname.h> #include <linux/utsname.h>
#include <linux/timex.h>
#include <linux/smp.h> #include <linux/smp.h>
#include <linux/smp_lock.h> #include <linux/smp_lock.h>
#include <linux/sem.h> #include <linux/sem.h>
...@@ -161,65 +160,6 @@ asmlinkage long compat_sys_sysfs(u32 option, u32 arg1, u32 arg2) ...@@ -161,65 +160,6 @@ asmlinkage long compat_sys_sysfs(u32 option, u32 arg1, u32 arg2)
return sys_sysfs((int)option, arg1, arg2); return sys_sysfs((int)option, arg1, arg2);
} }
/* Handle adjtimex compatibility. */
extern int do_adjtimex(struct timex *);
asmlinkage long compat_sys_adjtimex(struct compat_timex __user *utp)
{
struct timex txc;
int ret;
memset(&txc, 0, sizeof(struct timex));
if(get_user(txc.modes, &utp->modes) ||
__get_user(txc.offset, &utp->offset) ||
__get_user(txc.freq, &utp->freq) ||
__get_user(txc.maxerror, &utp->maxerror) ||
__get_user(txc.esterror, &utp->esterror) ||
__get_user(txc.status, &utp->status) ||
__get_user(txc.constant, &utp->constant) ||
__get_user(txc.precision, &utp->precision) ||
__get_user(txc.tolerance, &utp->tolerance) ||
__get_user(txc.time.tv_sec, &utp->time.tv_sec) ||
__get_user(txc.time.tv_usec, &utp->time.tv_usec) ||
__get_user(txc.tick, &utp->tick) ||
__get_user(txc.ppsfreq, &utp->ppsfreq) ||
__get_user(txc.jitter, &utp->jitter) ||
__get_user(txc.shift, &utp->shift) ||
__get_user(txc.stabil, &utp->stabil) ||
__get_user(txc.jitcnt, &utp->jitcnt) ||
__get_user(txc.calcnt, &utp->calcnt) ||
__get_user(txc.errcnt, &utp->errcnt) ||
__get_user(txc.stbcnt, &utp->stbcnt))
return -EFAULT;
ret = do_adjtimex(&txc);
if(put_user(txc.modes, &utp->modes) ||
__put_user(txc.offset, &utp->offset) ||
__put_user(txc.freq, &utp->freq) ||
__put_user(txc.maxerror, &utp->maxerror) ||
__put_user(txc.esterror, &utp->esterror) ||
__put_user(txc.status, &utp->status) ||
__put_user(txc.constant, &utp->constant) ||
__put_user(txc.precision, &utp->precision) ||
__put_user(txc.tolerance, &utp->tolerance) ||
__put_user(txc.time.tv_sec, &utp->time.tv_sec) ||
__put_user(txc.time.tv_usec, &utp->time.tv_usec) ||
__put_user(txc.tick, &utp->tick) ||
__put_user(txc.ppsfreq, &utp->ppsfreq) ||
__put_user(txc.jitter, &utp->jitter) ||
__put_user(txc.shift, &utp->shift) ||
__put_user(txc.stabil, &utp->stabil) ||
__put_user(txc.jitcnt, &utp->jitcnt) ||
__put_user(txc.calcnt, &utp->calcnt) ||
__put_user(txc.errcnt, &utp->errcnt) ||
__put_user(txc.stbcnt, &utp->stbcnt))
ret = -EFAULT;
return ret;
}
asmlinkage long compat_sys_pause(void) asmlinkage long compat_sys_pause(void)
{ {
current->state = TASK_INTERRUPTIBLE; current->state = TASK_INTERRUPTIBLE;
......
...@@ -26,7 +26,6 @@ ...@@ -26,7 +26,6 @@
#include <linux/resource.h> #include <linux/resource.h>
#include <linux/times.h> #include <linux/times.h>
#include <linux/utsname.h> #include <linux/utsname.h>
#include <linux/timex.h>
#include <linux/smp.h> #include <linux/smp.h>
#include <linux/smp_lock.h> #include <linux/smp_lock.h>
#include <linux/sem.h> #include <linux/sem.h>
...@@ -705,66 +704,6 @@ asmlinkage long sys32_sendfile64(int out_fd, int in_fd, ...@@ -705,66 +704,6 @@ asmlinkage long sys32_sendfile64(int out_fd, int in_fd,
return ret; return ret;
} }
/* Handle adjtimex compatibility. */
extern int do_adjtimex(struct timex *);
asmlinkage long sys32_adjtimex(struct compat_timex __user *utp)
{
struct timex txc;
int ret;
memset(&txc, 0, sizeof(struct timex));
if(get_user(txc.modes, &utp->modes) ||
__get_user(txc.offset, &utp->offset) ||
__get_user(txc.freq, &utp->freq) ||
__get_user(txc.maxerror, &utp->maxerror) ||
__get_user(txc.esterror, &utp->esterror) ||
__get_user(txc.status, &utp->status) ||
__get_user(txc.constant, &utp->constant) ||
__get_user(txc.precision, &utp->precision) ||
__get_user(txc.tolerance, &utp->tolerance) ||
__get_user(txc.time.tv_sec, &utp->time.tv_sec) ||
__get_user(txc.time.tv_usec, &utp->time.tv_usec) ||
__get_user(txc.tick, &utp->tick) ||
__get_user(txc.ppsfreq, &utp->ppsfreq) ||
__get_user(txc.jitter, &utp->jitter) ||
__get_user(txc.shift, &utp->shift) ||
__get_user(txc.stabil, &utp->stabil) ||
__get_user(txc.jitcnt, &utp->jitcnt) ||
__get_user(txc.calcnt, &utp->calcnt) ||
__get_user(txc.errcnt, &utp->errcnt) ||
__get_user(txc.stbcnt, &utp->stbcnt))
return -EFAULT;
ret = do_adjtimex(&txc);
if(put_user(txc.modes, &utp->modes) ||
__put_user(txc.offset, &utp->offset) ||
__put_user(txc.freq, &utp->freq) ||
__put_user(txc.maxerror, &utp->maxerror) ||
__put_user(txc.esterror, &utp->esterror) ||
__put_user(txc.status, &utp->status) ||
__put_user(txc.constant, &utp->constant) ||
__put_user(txc.precision, &utp->precision) ||
__put_user(txc.tolerance, &utp->tolerance) ||
__put_user(txc.time.tv_sec, &utp->time.tv_sec) ||
__put_user(txc.time.tv_usec, &utp->time.tv_usec) ||
__put_user(txc.tick, &utp->tick) ||
__put_user(txc.ppsfreq, &utp->ppsfreq) ||
__put_user(txc.jitter, &utp->jitter) ||
__put_user(txc.shift, &utp->shift) ||
__put_user(txc.stabil, &utp->stabil) ||
__put_user(txc.jitcnt, &utp->jitcnt) ||
__put_user(txc.calcnt, &utp->calcnt) ||
__put_user(txc.errcnt, &utp->errcnt) ||
__put_user(txc.stbcnt, &utp->stbcnt))
ret = -EFAULT;
return ret;
}
#ifdef CONFIG_SYSCTL #ifdef CONFIG_SYSCTL
struct __sysctl_args32 { struct __sysctl_args32 {
u32 name; u32 name;
......
...@@ -551,10 +551,10 @@ sys32_newuname_wrapper: ...@@ -551,10 +551,10 @@ sys32_newuname_wrapper:
llgtr %r2,%r2 # struct new_utsname * llgtr %r2,%r2 # struct new_utsname *
jg s390x_newuname # branch to system call jg s390x_newuname # branch to system call
.globl sys32_adjtimex_wrapper .globl compat_sys_adjtimex_wrapper
sys32_adjtimex_wrapper: compat_sys_adjtimex_wrapper:
llgtr %r2,%r2 # struct timex_emu31 * llgtr %r2,%r2 # struct compat_timex *
jg sys32_adjtimex # branch to system call jg compat_sys_adjtimex # branch to system call
.globl sys32_mprotect_wrapper .globl sys32_mprotect_wrapper
sys32_mprotect_wrapper: sys32_mprotect_wrapper:
......
...@@ -132,7 +132,7 @@ SYSCALL(sys_clone_glue,sys_clone_glue,sys32_clone_glue) /* 120 */ ...@@ -132,7 +132,7 @@ SYSCALL(sys_clone_glue,sys_clone_glue,sys32_clone_glue) /* 120 */
SYSCALL(sys_setdomainname,sys_setdomainname,sys32_setdomainname_wrapper) SYSCALL(sys_setdomainname,sys_setdomainname,sys32_setdomainname_wrapper)
SYSCALL(sys_newuname,s390x_newuname,sys32_newuname_wrapper) SYSCALL(sys_newuname,s390x_newuname,sys32_newuname_wrapper)
NI_SYSCALL /* modify_ldt for i386 */ NI_SYSCALL /* modify_ldt for i386 */
SYSCALL(sys_adjtimex,sys_adjtimex,sys32_adjtimex_wrapper) SYSCALL(sys_adjtimex,sys_adjtimex,compat_sys_adjtimex_wrapper)
SYSCALL(sys_mprotect,sys_mprotect,sys32_mprotect_wrapper) /* 125 */ SYSCALL(sys_mprotect,sys_mprotect,sys32_mprotect_wrapper) /* 125 */
SYSCALL(sys_sigprocmask,sys_sigprocmask,compat_sys_sigprocmask_wrapper) SYSCALL(sys_sigprocmask,sys_sigprocmask,compat_sys_sigprocmask_wrapper)
NI_SYSCALL /* old "create module" */ NI_SYSCALL /* old "create module" */
......
...@@ -19,7 +19,6 @@ ...@@ -19,7 +19,6 @@
#include <linux/resource.h> #include <linux/resource.h>
#include <linux/times.h> #include <linux/times.h>
#include <linux/utsname.h> #include <linux/utsname.h>
#include <linux/timex.h>
#include <linux/smp.h> #include <linux/smp.h>
#include <linux/smp_lock.h> #include <linux/smp_lock.h>
#include <linux/sem.h> #include <linux/sem.h>
...@@ -945,66 +944,6 @@ asmlinkage long compat_sys_sendfile64(int out_fd, int in_fd, ...@@ -945,66 +944,6 @@ asmlinkage long compat_sys_sendfile64(int out_fd, int in_fd,
return ret; return ret;
} }
/* Handle adjtimex compatibility. */
extern int do_adjtimex(struct timex *);
asmlinkage long sys32_adjtimex(struct compat_timex __user *utp)
{
struct timex txc;
int ret;
memset(&txc, 0, sizeof(struct timex));
if (get_user(txc.modes, &utp->modes) ||
__get_user(txc.offset, &utp->offset) ||
__get_user(txc.freq, &utp->freq) ||
__get_user(txc.maxerror, &utp->maxerror) ||
__get_user(txc.esterror, &utp->esterror) ||
__get_user(txc.status, &utp->status) ||
__get_user(txc.constant, &utp->constant) ||
__get_user(txc.precision, &utp->precision) ||
__get_user(txc.tolerance, &utp->tolerance) ||
__get_user(txc.time.tv_sec, &utp->time.tv_sec) ||
__get_user(txc.time.tv_usec, &utp->time.tv_usec) ||
__get_user(txc.tick, &utp->tick) ||
__get_user(txc.ppsfreq, &utp->ppsfreq) ||
__get_user(txc.jitter, &utp->jitter) ||
__get_user(txc.shift, &utp->shift) ||
__get_user(txc.stabil, &utp->stabil) ||
__get_user(txc.jitcnt, &utp->jitcnt) ||
__get_user(txc.calcnt, &utp->calcnt) ||
__get_user(txc.errcnt, &utp->errcnt) ||
__get_user(txc.stbcnt, &utp->stbcnt))
return -EFAULT;
ret = do_adjtimex(&txc);
if (put_user(txc.modes, &utp->modes) ||
__put_user(txc.offset, &utp->offset) ||
__put_user(txc.freq, &utp->freq) ||
__put_user(txc.maxerror, &utp->maxerror) ||
__put_user(txc.esterror, &utp->esterror) ||
__put_user(txc.status, &utp->status) ||
__put_user(txc.constant, &utp->constant) ||
__put_user(txc.precision, &utp->precision) ||
__put_user(txc.tolerance, &utp->tolerance) ||
__put_user(txc.time.tv_sec, &utp->time.tv_sec) ||
__put_user(txc.time.tv_usec, &utp->time.tv_usec) ||
__put_user(txc.tick, &utp->tick) ||
__put_user(txc.ppsfreq, &utp->ppsfreq) ||
__put_user(txc.jitter, &utp->jitter) ||
__put_user(txc.shift, &utp->shift) ||
__put_user(txc.stabil, &utp->stabil) ||
__put_user(txc.jitcnt, &utp->jitcnt) ||
__put_user(txc.calcnt, &utp->calcnt) ||
__put_user(txc.errcnt, &utp->errcnt) ||
__put_user(txc.stbcnt, &utp->stbcnt))
ret = -EFAULT;
return ret;
}
/* This is just a version for 32-bit applications which does /* This is just a version for 32-bit applications which does
* not force O_LARGEFILE on. * not force O_LARGEFILE on.
*/ */
......
...@@ -63,7 +63,7 @@ sys_call_table32: ...@@ -63,7 +63,7 @@ sys_call_table32:
/*200*/ .word sys32_ssetmask, sys_sigsuspend, compat_sys_newlstat, sys_uselib, compat_sys_old_readdir /*200*/ .word sys32_ssetmask, sys_sigsuspend, compat_sys_newlstat, sys_uselib, compat_sys_old_readdir
.word sys32_readahead, sys32_socketcall, sys32_syslog, sys32_lookup_dcookie, sys32_fadvise64 .word sys32_readahead, sys32_socketcall, sys32_syslog, sys32_lookup_dcookie, sys32_fadvise64
/*210*/ .word sys32_fadvise64_64, sys32_tgkill, sys32_waitpid, sys_swapoff, sys32_sysinfo /*210*/ .word sys32_fadvise64_64, sys32_tgkill, sys32_waitpid, sys_swapoff, sys32_sysinfo
.word sys32_ipc, sys32_sigreturn, sys_clone, sys32_ioprio_get, sys32_adjtimex .word sys32_ipc, sys32_sigreturn, sys_clone, sys32_ioprio_get, compat_sys_adjtimex
/*220*/ .word sys32_sigprocmask, sys_ni_syscall, sys32_delete_module, sys_ni_syscall, sys32_getpgid /*220*/ .word sys32_sigprocmask, sys_ni_syscall, sys32_delete_module, sys_ni_syscall, sys32_getpgid
.word sys32_bdflush, sys32_sysfs, sys_nis_syscall, sys32_setfsuid16, sys32_setfsgid16 .word sys32_bdflush, sys32_sysfs, sys_nis_syscall, sys32_setfsuid16, sys32_setfsgid16
/*230*/ .word sys32_select, compat_sys_time, sys_nis_syscall, compat_sys_stime, compat_sys_statfs64 /*230*/ .word sys32_select, compat_sys_time, sys_nis_syscall, compat_sys_stime, compat_sys_statfs64
......
...@@ -501,7 +501,7 @@ ia32_sys_call_table: ...@@ -501,7 +501,7 @@ ia32_sys_call_table:
.quad sys_setdomainname .quad sys_setdomainname
.quad sys_uname .quad sys_uname
.quad sys_modify_ldt .quad sys_modify_ldt
.quad sys32_adjtimex .quad compat_sys_adjtimex
.quad sys32_mprotect /* 125 */ .quad sys32_mprotect /* 125 */
.quad compat_sys_sigprocmask .quad compat_sys_sigprocmask
.quad quiet_ni_syscall /* create_module */ .quad quiet_ni_syscall /* create_module */
......
...@@ -30,7 +30,6 @@ ...@@ -30,7 +30,6 @@
#include <linux/resource.h> #include <linux/resource.h>
#include <linux/times.h> #include <linux/times.h>
#include <linux/utsname.h> #include <linux/utsname.h>
#include <linux/timex.h>
#include <linux/smp.h> #include <linux/smp.h>
#include <linux/smp_lock.h> #include <linux/smp_lock.h>
#include <linux/sem.h> #include <linux/sem.h>
...@@ -767,69 +766,6 @@ sys32_sendfile(int out_fd, int in_fd, compat_off_t __user *offset, s32 count) ...@@ -767,69 +766,6 @@ sys32_sendfile(int out_fd, int in_fd, compat_off_t __user *offset, s32 count)
return ret; return ret;
} }
/* Handle adjtimex compatibility. */
extern int do_adjtimex(struct timex *);
asmlinkage long
sys32_adjtimex(struct compat_timex __user *utp)
{
struct timex txc;
int ret;
memset(&txc, 0, sizeof(struct timex));
if (!access_ok(VERIFY_READ, utp, sizeof(struct compat_timex)) ||
__get_user(txc.modes, &utp->modes) ||
__get_user(txc.offset, &utp->offset) ||
__get_user(txc.freq, &utp->freq) ||
__get_user(txc.maxerror, &utp->maxerror) ||
__get_user(txc.esterror, &utp->esterror) ||
__get_user(txc.status, &utp->status) ||
__get_user(txc.constant, &utp->constant) ||
__get_user(txc.precision, &utp->precision) ||
__get_user(txc.tolerance, &utp->tolerance) ||
__get_user(txc.time.tv_sec, &utp->time.tv_sec) ||
__get_user(txc.time.tv_usec, &utp->time.tv_usec) ||
__get_user(txc.tick, &utp->tick) ||
__get_user(txc.ppsfreq, &utp->ppsfreq) ||
__get_user(txc.jitter, &utp->jitter) ||
__get_user(txc.shift, &utp->shift) ||
__get_user(txc.stabil, &utp->stabil) ||
__get_user(txc.jitcnt, &utp->jitcnt) ||
__get_user(txc.calcnt, &utp->calcnt) ||
__get_user(txc.errcnt, &utp->errcnt) ||
__get_user(txc.stbcnt, &utp->stbcnt))
return -EFAULT;
ret = do_adjtimex(&txc);
if (!access_ok(VERIFY_WRITE, utp, sizeof(struct compat_timex)) ||
__put_user(txc.modes, &utp->modes) ||
__put_user(txc.offset, &utp->offset) ||
__put_user(txc.freq, &utp->freq) ||
__put_user(txc.maxerror, &utp->maxerror) ||
__put_user(txc.esterror, &utp->esterror) ||
__put_user(txc.status, &utp->status) ||
__put_user(txc.constant, &utp->constant) ||
__put_user(txc.precision, &utp->precision) ||
__put_user(txc.tolerance, &utp->tolerance) ||
__put_user(txc.time.tv_sec, &utp->time.tv_sec) ||
__put_user(txc.time.tv_usec, &utp->time.tv_usec) ||
__put_user(txc.tick, &utp->tick) ||
__put_user(txc.ppsfreq, &utp->ppsfreq) ||
__put_user(txc.jitter, &utp->jitter) ||
__put_user(txc.shift, &utp->shift) ||
__put_user(txc.stabil, &utp->stabil) ||
__put_user(txc.jitcnt, &utp->jitcnt) ||
__put_user(txc.calcnt, &utp->calcnt) ||
__put_user(txc.errcnt, &utp->errcnt) ||
__put_user(txc.stbcnt, &utp->stbcnt))
ret = -EFAULT;
return ret;
}
asmlinkage long sys32_mmap2(unsigned long addr, unsigned long len, asmlinkage long sys32_mmap2(unsigned long addr, unsigned long len,
unsigned long prot, unsigned long flags, unsigned long prot, unsigned long flags,
unsigned long fd, unsigned long pgoff) unsigned long fd, unsigned long pgoff)
......
...@@ -207,5 +207,7 @@ static inline int compat_timespec_compare(struct compat_timespec *lhs, ...@@ -207,5 +207,7 @@ static inline int compat_timespec_compare(struct compat_timespec *lhs,
return lhs->tv_nsec - rhs->tv_nsec; return lhs->tv_nsec - rhs->tv_nsec;
} }
asmlinkage long compat_sys_adjtimex(struct compat_timex __user *utp);
#endif /* CONFIG_COMPAT */ #endif /* CONFIG_COMPAT */
#endif /* _LINUX_COMPAT_H */ #endif /* _LINUX_COMPAT_H */
...@@ -307,6 +307,8 @@ time_interpolator_reset(void) ...@@ -307,6 +307,8 @@ time_interpolator_reset(void)
/* Returns how long ticks are at present, in ns / 2^(SHIFT_SCALE-10). */ /* Returns how long ticks are at present, in ns / 2^(SHIFT_SCALE-10). */
extern u64 current_tick_length(void); extern u64 current_tick_length(void);
extern int do_adjtimex(struct timex *);
#endif /* KERNEL */ #endif /* KERNEL */
#endif /* LINUX_TIMEX_H */ #endif /* LINUX_TIMEX_H */
...@@ -21,6 +21,7 @@ ...@@ -21,6 +21,7 @@
#include <linux/syscalls.h> #include <linux/syscalls.h>
#include <linux/unistd.h> #include <linux/unistd.h>
#include <linux/security.h> #include <linux/security.h>
#include <linux/timex.h>
#include <asm/uaccess.h> #include <asm/uaccess.h>
...@@ -898,3 +899,61 @@ asmlinkage long compat_sys_rt_sigsuspend(compat_sigset_t __user *unewset, compat ...@@ -898,3 +899,61 @@ asmlinkage long compat_sys_rt_sigsuspend(compat_sigset_t __user *unewset, compat
return -ERESTARTNOHAND; return -ERESTARTNOHAND;
} }
#endif /* __ARCH_WANT_COMPAT_SYS_RT_SIGSUSPEND */ #endif /* __ARCH_WANT_COMPAT_SYS_RT_SIGSUSPEND */
asmlinkage long compat_sys_adjtimex(struct compat_timex __user *utp)
{
struct timex txc;
int ret;
memset(&txc, 0, sizeof(struct timex));
if (!access_ok(VERIFY_READ, utp, sizeof(struct compat_timex)) ||
__get_user(txc.modes, &utp->modes) ||
__get_user(txc.offset, &utp->offset) ||
__get_user(txc.freq, &utp->freq) ||
__get_user(txc.maxerror, &utp->maxerror) ||
__get_user(txc.esterror, &utp->esterror) ||
__get_user(txc.status, &utp->status) ||
__get_user(txc.constant, &utp->constant) ||
__get_user(txc.precision, &utp->precision) ||
__get_user(txc.tolerance, &utp->tolerance) ||
__get_user(txc.time.tv_sec, &utp->time.tv_sec) ||
__get_user(txc.time.tv_usec, &utp->time.tv_usec) ||
__get_user(txc.tick, &utp->tick) ||
__get_user(txc.ppsfreq, &utp->ppsfreq) ||
__get_user(txc.jitter, &utp->jitter) ||
__get_user(txc.shift, &utp->shift) ||
__get_user(txc.stabil, &utp->stabil) ||
__get_user(txc.jitcnt, &utp->jitcnt) ||
__get_user(txc.calcnt, &utp->calcnt) ||
__get_user(txc.errcnt, &utp->errcnt) ||
__get_user(txc.stbcnt, &utp->stbcnt))
return -EFAULT;
ret = do_adjtimex(&txc);
if (!access_ok(VERIFY_WRITE, utp, sizeof(struct compat_timex)) ||
__put_user(txc.modes, &utp->modes) ||
__put_user(txc.offset, &utp->offset) ||
__put_user(txc.freq, &utp->freq) ||
__put_user(txc.maxerror, &utp->maxerror) ||
__put_user(txc.esterror, &utp->esterror) ||
__put_user(txc.status, &utp->status) ||
__put_user(txc.constant, &utp->constant) ||
__put_user(txc.precision, &utp->precision) ||
__put_user(txc.tolerance, &utp->tolerance) ||
__put_user(txc.time.tv_sec, &utp->time.tv_sec) ||
__put_user(txc.time.tv_usec, &utp->time.tv_usec) ||
__put_user(txc.tick, &utp->tick) ||
__put_user(txc.ppsfreq, &utp->ppsfreq) ||
__put_user(txc.jitter, &utp->jitter) ||
__put_user(txc.shift, &utp->shift) ||
__put_user(txc.stabil, &utp->stabil) ||
__put_user(txc.jitcnt, &utp->jitcnt) ||
__put_user(txc.calcnt, &utp->calcnt) ||
__put_user(txc.errcnt, &utp->errcnt) ||
__put_user(txc.stbcnt, &utp->stbcnt))
ret = -EFAULT;
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