Gitweb:     
http://git.kernel.org/git/?p=linux/kernel/git/torvalds/linux-2.6.git;a=commit;h=83f5d1266926c75890f1bc4678e49d79483cb573
Commit:     83f5d1266926c75890f1bc4678e49d79483cb573
Parent:     57ac8898508638ca6d15ecd8b911a431d673ff30
Author:     Davide Libenzi <[EMAIL PROTECTED]>
AuthorDate: Thu May 10 22:23:18 2007 -0700
Committer:  Linus Torvalds <[EMAIL PROTECTED]>
CommitDate: Fri May 11 08:29:36 2007 -0700

    signal/timer/event: timerfd compat code
    
    This patch implements the necessary compat code for the timerfd system call.
    
    Signed-off-by: Davide Libenzi <[EMAIL PROTECTED]>
    Signed-off-by: Andrew Morton <[EMAIL PROTECTED]>
    Signed-off-by: Linus Torvalds <[EMAIL PROTECTED]>
---
 fs/compat.c            |   23 +++++++++++++++++++++++
 include/linux/compat.h |    5 +++++
 kernel/compat.c        |    8 ++++----
 3 files changed, 32 insertions(+), 4 deletions(-)

diff --git a/fs/compat.c b/fs/compat.c
index 2487b83..7b21b0a 100644
--- a/fs/compat.c
+++ b/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/include/linux/compat.h b/include/linux/compat.h
index 70a157a..636502c 100644
--- a/include/linux/compat.h
+++ b/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/kernel/compat.c b/kernel/compat.c
index cebb4c2..3bae374 100644
--- a/kernel/compat.c
+++ b/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))
-
To unsubscribe from this list: send the line "unsubscribe git-commits-head" in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html

Reply via email to