History

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.

Deepa Dinamani committed 8 years ago

Commit d0dd63a1 parent dc1b7b64 files · +12 −4Browse files

Unified · Split

4 files
  1. include/linux/time.h +2 −2
  2. include/linux/time64.h +1 −0
  3. include/uapi/linux/time.h +7 −0
  4. kernel/time/time.c +2 −2
include/linux/time.h+2−2
@@ -14,9 +14,9 @@ int get_timespec64(struct timespec64 *ts, · 13 unmodified lines
14int put_timespec64(const struct timespec64 *ts,14int put_timespec64(const struct timespec64 *ts,
15 struct __kernel_timespec __user *uts);15 struct __kernel_timespec __user *uts);
16int get_itimerspec64(struct itimerspec64 *it,16int get_itimerspec64(struct itimerspec64 *it,
17 const struct itimerspec __user *uit);17 const struct __kernel_itimerspec __user *uit);
18int put_itimerspec64(const struct itimerspec64 *it,18int put_itimerspec64(const struct itimerspec64 *it,
19 struct itimerspec __user *uit);19 struct __kernel_itimerspec __user *uit);
20 20
21extern time64_t mktime64(const unsigned int year, const unsigned int mon,21extern time64_t mktime64(const unsigned int year, const unsigned int mon,
22 const unsigned int day, const unsigned int hour,22 const unsigned int day, const unsigned int hour,
include/linux/time64.h+1−0
@@ -12,6 +12,7 @@ typedef __u64 timeu64_t; · 11 unmodified lines
12 */12 */
13#ifndef CONFIG_64BIT_TIME13#ifndef CONFIG_64BIT_TIME
14#define __kernel_timespec timespec14#define __kernel_timespec timespec
15#define __kernel_itimerspec itimerspec
15#endif16#endif
16 17
17#include <uapi/linux/time.h>18#include <uapi/linux/time.h>
include/uapi/linux/time.h+7−0
@@ -49,6 +49,13 @@ struct __kernel_timespec { · 48 unmodified lines
49};49};
50#endif50#endif
51 51
52#ifndef __kernel_itimerspec
53struct __kernel_itimerspec {
54 struct __kernel_timespec it_interval; /* timer period */
55 struct __kernel_timespec it_value; /* timer expiration */
56};
57#endif
58
52/*59/*
53 * legacy timeval structure, only embedded in structures that60 * legacy timeval structure, only embedded in structures that
54 * traditionally used 'timeval' to pass time intervals (not absolute61 * traditionally used 'timeval' to pass time intervals (not absolute
kernel/time/time.c+2−2
@@ -927,7 +927,7 @@ int compat_put_timespec64(const struct timespec64 *ts, void __user *uts) · 926 unmodified lines
927EXPORT_SYMBOL_GPL(compat_put_timespec64);927EXPORT_SYMBOL_GPL(compat_put_timespec64);
928 928
929int get_itimerspec64(struct itimerspec64 *it,929int get_itimerspec64(struct itimerspec64 *it,
930 const struct itimerspec __user *uit)930 const struct __kernel_itimerspec __user *uit)
931{931{
932 int ret;932 int ret;
933 933
@@ -942,7 +942,7 @@ int get_itimerspec64(struct itimerspec64 *it, · 8 unmodified lines
942EXPORT_SYMBOL_GPL(get_itimerspec64);942EXPORT_SYMBOL_GPL(get_itimerspec64);
943 943
944int put_itimerspec64(const struct itimerspec64 *it,944int put_itimerspec64(const struct itimerspec64 *it,
945 struct itimerspec __user *uit)945 struct __kernel_itimerspec __user *uit)
946{946{
947 int ret;947 int ret;
948 948