[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-Id: <e52f24edbeabdaa87ae8d999c0a367eca920d32b.1434079262.git.baolin.wang@linaro.org>
Date: Fri, 12 Jun 2015 15:44:47 +0800
From: Baolin Wang <baolin.wang@...aro.org>
To: tglx@...utronix.de
Cc: arnd@...db.de, john.stultz@...aro.org, pang.xunlei@...aro.org,
mingo@...nel.org, peterz@...radead.org,
linux-kernel@...r.kernel.org, baolin.wang@...aro.org,
y2038@...ts.linaro.org
Subject: [PATCH v5 04/24] time: Introduce do_sys_settimeofday64()
Due to the do_sys_settimeofday() with timespec type is not year 2038
safe on 32bit systems, and it should introduce the do_sys_settimeofday64()
function with timespec64 type to make it is ready for 2038 issue.
For removing the old do_sys_settimeofday() function with timespec type
conveniently in future, it should move the do_sys_settimeofday() function
to the timekeeping.h file as a 'static inline' helper that just calls
do_sys_settimeofday64().
Signed-off-by: Baolin Wang <baolin.wang@...aro.org>
---
include/linux/timekeeping.h | 11 +++++++++--
kernel/time/time.c | 8 ++++----
2 files changed, 13 insertions(+), 6 deletions(-)
diff --git a/include/linux/timekeeping.h b/include/linux/timekeeping.h
index f886bdb..2dcc86b 100644
--- a/include/linux/timekeeping.h
+++ b/include/linux/timekeeping.h
@@ -11,8 +11,15 @@ extern int timekeeping_suspended;
*/
extern void do_gettimeofday(struct timeval *tv);
extern int do_settimeofday64(const struct timespec64 *ts);
-extern int do_sys_settimeofday(const struct timespec *tv,
- const struct timezone *tz);
+extern int do_sys_settimeofday64(const struct timespec64 *tv,
+ const struct timezone *tz);
+static inline int do_sys_settimeofday(const struct timespec *tv,
+ const struct timezone *tz)
+{
+ struct timespec64 ts64 = timespec_to_timespec64(*tv);
+
+ return do_sys_settimeofday64(&ts64, tz);
+}
/*
* Kernel time accessors
diff --git a/kernel/time/time.c b/kernel/time/time.c
index 972e3bb..5aefe2d 100644
--- a/kernel/time/time.c
+++ b/kernel/time/time.c
@@ -160,15 +160,15 @@ static inline void warp_clock(void)
* various programs will get confused when the clock gets warped.
*/
-int do_sys_settimeofday(const struct timespec *tv, const struct timezone *tz)
+int do_sys_settimeofday64(const struct timespec64 *tv, const struct timezone *tz)
{
static int firsttime = 1;
int error = 0;
- if (tv && !timespec_valid(tv))
+ if (tv && !timespec64_valid(tv))
return -EINVAL;
- error = security_settime(tv, tz);
+ error = security_settime64(tv, tz);
if (error)
return error;
@@ -186,7 +186,7 @@ int do_sys_settimeofday(const struct timespec *tv, const struct timezone *tz)
}
}
if (tv)
- return do_settimeofday(tv);
+ return do_settimeofday64(tv);
return 0;
}
--
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