Commit 83f5d126 authored by Davide Libenzi's avatar Davide Libenzi Committed by Linus Torvalds

signal/timer/event: timerfd compat code

This patch implements the necessary compat code for the timerfd system call.
Signed-off-by: default avatarDavide Libenzi <davidel@xmailserver.org>
Signed-off-by: default avatarAndrew Morton <akpm@linux-foundation.org>
Signed-off-by: default avatarLinus Torvalds <torvalds@linux-foundation.org>
parent 57ac8898
...@@ -2225,3 +2225,26 @@ asmlinkage long compat_sys_signalfd(int ufd, ...@@ -2225,3 +2225,26 @@ asmlinkage long compat_sys_signalfd(int ufd,
#endif /* CONFIG_SIGNALFD */ #endif /* CONFIG_SIGNALFD */
#ifdef CONFIG_TIMERFD
asmlinkage long compat_sys_timerfd(int ufd, int clockid, int flags,
const struct compat_itimerspec __user *utmr)
{
long res;
struct itimerspec t;
struct itimerspec __user *ut;
res = -EFAULT;
if (get_compat_itimerspec(&t, utmr))
goto err_exit;
ut = compat_alloc_user_space(sizeof(*ut));
if (copy_to_user(ut, &t, sizeof(t)) )
goto err_exit;
res = sys_timerfd(ufd, clockid, flags, ut);
err_exit:
return res;
}
#endif /* CONFIG_TIMERFD */
...@@ -225,6 +225,11 @@ static inline int compat_timespec_compare(struct compat_timespec *lhs, ...@@ -225,6 +225,11 @@ static inline int compat_timespec_compare(struct compat_timespec *lhs,
return lhs->tv_nsec - rhs->tv_nsec; return lhs->tv_nsec - rhs->tv_nsec;
} }
extern int get_compat_itimerspec(struct itimerspec *dst,
const struct compat_itimerspec __user *src);
extern int put_compat_itimerspec(struct compat_itimerspec __user *dst,
const struct itimerspec *src);
asmlinkage long compat_sys_adjtimex(struct compat_timex __user *utp); asmlinkage long compat_sys_adjtimex(struct compat_timex __user *utp);
extern int compat_printk(const char *fmt, ...); extern int compat_printk(const char *fmt, ...);
......
...@@ -475,8 +475,8 @@ asmlinkage long compat_sys_sched_getaffinity(compat_pid_t pid, unsigned int len, ...@@ -475,8 +475,8 @@ asmlinkage long compat_sys_sched_getaffinity(compat_pid_t pid, unsigned int len,
return min_length; return min_length;
} }
static int get_compat_itimerspec(struct itimerspec *dst, int get_compat_itimerspec(struct itimerspec *dst,
struct compat_itimerspec __user *src) const struct compat_itimerspec __user *src)
{ {
if (get_compat_timespec(&dst->it_interval, &src->it_interval) || if (get_compat_timespec(&dst->it_interval, &src->it_interval) ||
get_compat_timespec(&dst->it_value, &src->it_value)) get_compat_timespec(&dst->it_value, &src->it_value))
...@@ -484,8 +484,8 @@ static int get_compat_itimerspec(struct itimerspec *dst, ...@@ -484,8 +484,8 @@ static int get_compat_itimerspec(struct itimerspec *dst,
return 0; return 0;
} }
static int put_compat_itimerspec(struct compat_itimerspec __user *dst, int put_compat_itimerspec(struct compat_itimerspec __user *dst,
struct itimerspec *src) const struct itimerspec *src)
{ {
if (put_compat_timespec(&src->it_interval, &dst->it_interval) || if (put_compat_timespec(&src->it_interval, &dst->it_interval) ||
put_compat_timespec(&src->it_value, &dst->it_value)) put_compat_timespec(&src->it_value, &dst->it_value))
......
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