Skip to content

Commit d0dd63a

Browse files
deepa-hubKAGA-KOKO
authored andcommitted
time: Introduce struct __kernel_itimerspec
struct itimerspec is not y2038-safe. Introduce a new struct __kernel_itimerspec based on the kernel internal y2038-safe struct itimerspec64. The definition of struct __kernel_itimerspec includes two struct __kernel_timespec. Since struct __kernel_timespec has the same representation in native and compat modes, so does struct __kernel_itimerspec. This helps have a common entry point for syscalls using struct __kernel_itimerspec. New y2038-safe syscalls will use this new type. Since most of the new syscalls are just an update to the native syscalls with the type update, place the new definition under CONFIG_64BIT_TIME. This helps architectures that do not support the above config to keep using the old definition of struct itimerspec. Also change the get/put_itimerspec64 to use struct__kernel_itimerspec. This will help 32 bit architectures to use the new syscalls when architectures select CONFIG_64BIT_TIME. Signed-off-by: Deepa Dinamani <deepa.kernel@gmail.com> Signed-off-by: Thomas Gleixner <tglx@linutronix.de> Cc: arnd@arndb.de Cc: viro@zeniv.linux.org.uk Cc: linux-fsdevel@vger.kernel.org Cc: linux-api@vger.kernel.org Cc: y2038@lists.linaro.org Link: https://lkml.kernel.org/r/20180617051144.29756-2-deepa.kernel@gmail.com
1 parent dc1b7b6 commit d0dd63a

File tree

4 files changed

+12
-4
lines changed

4 files changed

+12
-4
lines changed

include/linux/time.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,9 +14,9 @@ int get_timespec64(struct timespec64 *ts,
1414
int put_timespec64(const struct timespec64 *ts,
1515
struct __kernel_timespec __user *uts);
1616
int get_itimerspec64(struct itimerspec64 *it,
17-
const struct itimerspec __user *uit);
17+
const struct __kernel_itimerspec __user *uit);
1818
int put_itimerspec64(const struct itimerspec64 *it,
19-
struct itimerspec __user *uit);
19+
struct __kernel_itimerspec __user *uit);
2020

2121
extern time64_t mktime64(const unsigned int year, const unsigned int mon,
2222
const unsigned int day, const unsigned int hour,

include/linux/time64.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@ typedef __u64 timeu64_t;
1212
*/
1313
#ifndef CONFIG_64BIT_TIME
1414
#define __kernel_timespec timespec
15+
#define __kernel_itimerspec itimerspec
1516
#endif
1617

1718
#include <uapi/linux/time.h>

include/uapi/linux/time.h

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -49,6 +49,13 @@ struct __kernel_timespec {
4949
};
5050
#endif
5151

52+
#ifndef __kernel_itimerspec
53+
struct __kernel_itimerspec {
54+
struct __kernel_timespec it_interval; /* timer period */
55+
struct __kernel_timespec it_value; /* timer expiration */
56+
};
57+
#endif
58+
5259
/*
5360
* legacy timeval structure, only embedded in structures that
5461
* traditionally used 'timeval' to pass time intervals (not absolute

kernel/time/time.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -927,7 +927,7 @@ int compat_put_timespec64(const struct timespec64 *ts, void __user *uts)
927927
EXPORT_SYMBOL_GPL(compat_put_timespec64);
928928

929929
int get_itimerspec64(struct itimerspec64 *it,
930-
const struct itimerspec __user *uit)
930+
const struct __kernel_itimerspec __user *uit)
931931
{
932932
int ret;
933933

@@ -942,7 +942,7 @@ int get_itimerspec64(struct itimerspec64 *it,
942942
EXPORT_SYMBOL_GPL(get_itimerspec64);
943943

944944
int put_itimerspec64(const struct itimerspec64 *it,
945-
struct itimerspec __user *uit)
945+
struct __kernel_itimerspec __user *uit)
946946
{
947947
int ret;
948948

0 commit comments

Comments
 (0)