mirror of
https://github.com/Fishwaldo/Star64_linux.git
synced 2025-06-21 06:01:23 +00:00
time: Change k_clock clock_get() to use timespec64
struct timespec is not y2038 safe on 32 bit machines. Replace uses of struct timespec with struct timespec64 in the kernel. The syscall interfaces themselves will be changed in a separate series. Signed-off-by: Deepa Dinamani <deepa.kernel@gmail.com> Cc: y2038@lists.linaro.org Cc: john.stultz@linaro.org Cc: arnd@arndb.de Link: http://lkml.kernel.org/r/1490555058-4603-4-git-send-email-deepa.kernel@gmail.com Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
This commit is contained in:
parent
d340266e19
commit
3c9c12f4b4
8 changed files with 41 additions and 34 deletions
|
@ -64,14 +64,17 @@ SYSCALL_DEFINE2(clock_settime, const clockid_t, which_clock,
|
|||
SYSCALL_DEFINE2(clock_gettime, const clockid_t, which_clock,
|
||||
struct timespec __user *,tp)
|
||||
{
|
||||
struct timespec64 kernel_tp64;
|
||||
struct timespec kernel_tp;
|
||||
|
||||
switch (which_clock) {
|
||||
case CLOCK_REALTIME: ktime_get_real_ts(&kernel_tp); break;
|
||||
case CLOCK_MONOTONIC: ktime_get_ts(&kernel_tp); break;
|
||||
case CLOCK_BOOTTIME: get_monotonic_boottime(&kernel_tp); break;
|
||||
case CLOCK_REALTIME: ktime_get_real_ts64(&kernel_tp64); break;
|
||||
case CLOCK_MONOTONIC: ktime_get_ts64(&kernel_tp64); break;
|
||||
case CLOCK_BOOTTIME: get_monotonic_boottime64(&kernel_tp64); break;
|
||||
default: return -EINVAL;
|
||||
}
|
||||
|
||||
kernel_tp = timespec64_to_timespec(kernel_tp64);
|
||||
if (copy_to_user(tp, &kernel_tp, sizeof (kernel_tp)))
|
||||
return -EFAULT;
|
||||
return 0;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue