From 91e3167f7eb7c7b6868b06572b2a46b6089b0a53 Mon Sep 17 00:00:00 2001 From: Davide Libenzi Date: Thu, 10 May 2007 22:23:18 -0700 Subject: [PATCH] --- yaml --- r: 55931 b: refs/heads/master c: 83f5d1266926c75890f1bc4678e49d79483cb573 h: refs/heads/master i: 55929: d3278fbd868d5810a6f94a942ecb954f7c32d6ae 55927: 873ecf766ca57409d4604d3f9ad41b439b5a7d0b v: v3 --- [refs] | 2 +- trunk/fs/compat.c | 23 +++++++++++++++++++++++ trunk/include/linux/compat.h | 5 +++++ trunk/kernel/compat.c | 8 ++++---- 4 files changed, 33 insertions(+), 5 deletions(-) diff --git a/[refs] b/[refs] index 8d76ef95d2d6..385bd7982ec2 100644 --- a/[refs] +++ b/[refs] @@ -1,2 +1,2 @@ --- -refs/heads/master: 57ac8898508638ca6d15ecd8b911a431d673ff30 +refs/heads/master: 83f5d1266926c75890f1bc4678e49d79483cb573 diff --git a/trunk/fs/compat.c b/trunk/fs/compat.c index 2487b83b18df..7b21b0a82596 100644 --- a/trunk/fs/compat.c +++ b/trunk/fs/compat.c @@ -2225,3 +2225,26 @@ asmlinkage long compat_sys_signalfd(int ufd, #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 */ + diff --git a/trunk/include/linux/compat.h b/trunk/include/linux/compat.h index 70a157a130bb..636502c02734 100644 --- a/trunk/include/linux/compat.h +++ b/trunk/include/linux/compat.h @@ -225,6 +225,11 @@ static inline int compat_timespec_compare(struct compat_timespec *lhs, 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); extern int compat_printk(const char *fmt, ...); diff --git a/trunk/kernel/compat.c b/trunk/kernel/compat.c index cebb4c28c039..3bae3742c2aa 100644 --- a/trunk/kernel/compat.c +++ b/trunk/kernel/compat.c @@ -475,8 +475,8 @@ asmlinkage long compat_sys_sched_getaffinity(compat_pid_t pid, unsigned int len, return min_length; } -static int get_compat_itimerspec(struct itimerspec *dst, - struct compat_itimerspec __user *src) +int get_compat_itimerspec(struct itimerspec *dst, + const struct compat_itimerspec __user *src) { if (get_compat_timespec(&dst->it_interval, &src->it_interval) || get_compat_timespec(&dst->it_value, &src->it_value)) @@ -484,8 +484,8 @@ static int get_compat_itimerspec(struct itimerspec *dst, return 0; } -static int put_compat_itimerspec(struct compat_itimerspec __user *dst, - struct itimerspec *src) +int put_compat_itimerspec(struct compat_itimerspec __user *dst, + const struct itimerspec *src) { if (put_compat_timespec(&src->it_interval, &dst->it_interval) || put_compat_timespec(&src->it_value, &dst->it_value))