[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-Id: <320d585c9cc4bbbda014f0a2bdcd55fe69b347cc.1434079263.git.baolin.wang@linaro.org>
Date: Fri, 12 Jun 2015 15:48:21 +0800
From: Baolin Wang <baolin.wang@...aro.org>
To: tglx@...utronix.de
Cc: arnd@...db.de, linux-kernel@...r.kernel.org,
baolin.wang@...aro.org, y2038@...ts.linaro.org
Subject: [PATCH v5 06/24] posix-timers: Factor out the guts of 'timer_gettime' for reusing
In order to reuse the very same logic for the year 2038 safe syscalls
which we need to introduce for 32bit systems, factor out the guts of
the 'timer_gettime' syscall.
Signed-off-by: Baolin Wang <baolin.wang@...aro.org>
---
kernel/time/posix-timers.c | 16 +++++++++++-----
1 file changed, 11 insertions(+), 5 deletions(-)
diff --git a/kernel/time/posix-timers.c b/kernel/time/posix-timers.c
index 5ddd912..7d1973a 100644
--- a/kernel/time/posix-timers.c
+++ b/kernel/time/posix-timers.c
@@ -802,11 +802,8 @@ common_timer_get(struct k_itimer *timr, struct itimerspec *cur_setting)
cur_setting->it_value = ktime_to_timespec(remaining);
}
-/* Get the time remaining on a POSIX.1b interval timer. */
-SYSCALL_DEFINE2(timer_gettime, timer_t, timer_id,
- struct itimerspec __user *, setting)
+static int __timer_gettime(timer_t timer_id, struct itimerspec *cur_setting)
{
- struct itimerspec cur_setting;
struct k_itimer *timr;
struct k_clock *kc;
unsigned long flags;
@@ -820,9 +817,18 @@ SYSCALL_DEFINE2(timer_gettime, timer_t, timer_id,
if (WARN_ON_ONCE(!kc || !kc->timer_get))
ret = -EINVAL;
else
- kc->timer_get(timr, &cur_setting);
+ kc->timer_get(timr, cur_setting);
unlock_timer(timr, flags);
+ return ret;
+}
+
+/* Get the time remaining on a POSIX.1b interval timer. */
+SYSCALL_DEFINE2(timer_gettime, timer_t, timer_id,
+ struct itimerspec __user *, setting)
+{
+ struct itimerspec cur_setting;
+ int ret = __timer_gettime(timer_id, &cur_setting);
if (!ret && copy_to_user(setting, &cur_setting, sizeof (cur_setting)))
return -EFAULT;
--
1.7.9.5
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
Powered by blists - more mailing lists