32-bit architectures that want to use a 64-bit time_t need a definition of timerfd_gettime and timerfd_settime that takes __kernel_itimerspec arguments, and use the compat_time syscalls for the legacy support.
Signed-off-by: Arnd Bergmann arnd@arndb.de --- fs/timerfd.c | 13 +++++++------ include/linux/syscalls.h | 6 +++--- 2 files changed, 10 insertions(+), 9 deletions(-)
diff --git a/fs/timerfd.c b/fs/timerfd.c index b94fa6c3c6eb..4e80fc2d6c32 100644 --- a/fs/timerfd.c +++ b/fs/timerfd.c @@ -11,6 +11,7 @@ #include <linux/alarmtimer.h> #include <linux/file.h> #include <linux/poll.h> +#include <linux/posix-timers.h> #include <linux/init.h> #include <linux/fs.h> #include <linux/sched.h> @@ -512,30 +513,30 @@ static int do_timerfd_gettime(int ufd, struct itimerspec *t) }
SYSCALL_DEFINE4(timerfd_settime, int, ufd, int, flags, - const struct itimerspec __user *, utmr, - struct itimerspec __user *, otmr) + const struct __kernel_itimerspec __user *, utmr, + struct __kernel_itimerspec __user *, otmr) { struct itimerspec new, old; int ret;
- if (copy_from_user(&new, utmr, sizeof(new))) + if (get_itimerspec(&new, utmr)) return -EFAULT; ret = do_timerfd_settime(ufd, flags, &new, &old); if (ret) return ret; - if (otmr && copy_to_user(otmr, &old, sizeof(old))) + if (otmr && put_itimerspec(&old, otmr)) return -EFAULT;
return ret; }
-SYSCALL_DEFINE2(timerfd_gettime, int, ufd, struct itimerspec __user *, otmr) +SYSCALL_DEFINE2(timerfd_gettime, int, ufd, struct __kernel_itimerspec __user *, otmr) { struct itimerspec kotmr; int ret = do_timerfd_gettime(ufd, &kotmr); if (ret) return ret; - return copy_to_user(otmr, &kotmr, sizeof(kotmr)) ? -EFAULT: 0; + return put_itimerspec(&kotmr, otmr); }
#ifdef CONFIG_COMPAT diff --git a/include/linux/syscalls.h b/include/linux/syscalls.h index ad196d7b9eba..fec7a2cfb1a4 100644 --- a/include/linux/syscalls.h +++ b/include/linux/syscalls.h @@ -802,9 +802,9 @@ asmlinkage long sys_signalfd(int ufd, sigset_t __user *user_mask, size_t sizemas asmlinkage long sys_signalfd4(int ufd, sigset_t __user *user_mask, size_t sizemask, int flags); asmlinkage long sys_timerfd_create(int clockid, int flags); asmlinkage long sys_timerfd_settime(int ufd, int flags, - const struct itimerspec __user *utmr, - struct itimerspec __user *otmr); -asmlinkage long sys_timerfd_gettime(int ufd, struct itimerspec __user *otmr); + const struct __kernel_itimerspec __user *utmr, + struct __kernel_itimerspec __user *otmr); +asmlinkage long sys_timerfd_gettime(int ufd, struct __kernel_itimerspec __user *otmr); asmlinkage long sys_eventfd(unsigned int count); asmlinkage long sys_eventfd2(unsigned int count, int flags); asmlinkage long sys_memfd_create(const char __user *uname_ptr, unsigned int flags);