Merge branch 'timers-core-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip
Pull timekeeping updates from Thomas Gleixner: "The timers and timekeeping departement provides: - Another large y2038 update with further preparations for providing the y2038 safe timespecs closer to the syscalls. - An overhaul of the SHCMT clocksource driver - SPDX license identifier updates - Small cleanups and fixes all over the place" * 'timers-core-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip: (31 commits) tick/sched : Remove redundant cpu_online() check clocksource/drivers/dw_apb: Add reset control clocksource: Remove obsolete CLOCKSOURCE_OF_DECLARE clocksource/drivers: Unify the names to timer-* format clocksource/drivers/sh_cmt: Add R-Car gen3 support dt-bindings: timer: renesas: cmt: document R-Car gen3 support clocksource/drivers/sh_cmt: Properly line-wrap sh_cmt_of_table[] initializer clocksource/drivers/sh_cmt: Fix clocksource width for 32-bit machines clocksource/drivers/sh_cmt: Fixup for 64-bit machines clocksource/drivers/sh_tmu: Convert to SPDX identifiers clocksource/drivers/sh_mtu2: Convert to SPDX identifiers clocksource/drivers/sh_cmt: Convert to SPDX identifiers clocksource/drivers/renesas-ostm: Convert to SPDX identifiers clocksource: Convert to using %pOFn instead of device_node.name tick/broadcast: Remove redundant check RISC-V: Request newstat syscalls y2038: signal: Change rt_sigtimedwait to use __kernel_timespec y2038: socket: Change recvmmsg to use __kernel_timespec y2038: sched: Change sched_rr_get_interval to use __kernel_timespec y2038: utimes: Rework #ifdef guards for compat syscalls ...
This commit is contained in:
@@ -93,28 +93,28 @@ int compat_put_timex(struct compat_timex __user *utp, const struct timex *txc)
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int __compat_get_timeval(struct timeval *tv, const struct compat_timeval __user *ctv)
|
||||
static int __compat_get_timeval(struct timeval *tv, const struct old_timeval32 __user *ctv)
|
||||
{
|
||||
return (!access_ok(VERIFY_READ, ctv, sizeof(*ctv)) ||
|
||||
__get_user(tv->tv_sec, &ctv->tv_sec) ||
|
||||
__get_user(tv->tv_usec, &ctv->tv_usec)) ? -EFAULT : 0;
|
||||
}
|
||||
|
||||
static int __compat_put_timeval(const struct timeval *tv, struct compat_timeval __user *ctv)
|
||||
static int __compat_put_timeval(const struct timeval *tv, struct old_timeval32 __user *ctv)
|
||||
{
|
||||
return (!access_ok(VERIFY_WRITE, ctv, sizeof(*ctv)) ||
|
||||
__put_user(tv->tv_sec, &ctv->tv_sec) ||
|
||||
__put_user(tv->tv_usec, &ctv->tv_usec)) ? -EFAULT : 0;
|
||||
}
|
||||
|
||||
static int __compat_get_timespec(struct timespec *ts, const struct compat_timespec __user *cts)
|
||||
static int __compat_get_timespec(struct timespec *ts, const struct old_timespec32 __user *cts)
|
||||
{
|
||||
return (!access_ok(VERIFY_READ, cts, sizeof(*cts)) ||
|
||||
__get_user(ts->tv_sec, &cts->tv_sec) ||
|
||||
__get_user(ts->tv_nsec, &cts->tv_nsec)) ? -EFAULT : 0;
|
||||
}
|
||||
|
||||
static int __compat_put_timespec(const struct timespec *ts, struct compat_timespec __user *cts)
|
||||
static int __compat_put_timespec(const struct timespec *ts, struct old_timespec32 __user *cts)
|
||||
{
|
||||
return (!access_ok(VERIFY_WRITE, cts, sizeof(*cts)) ||
|
||||
__put_user(ts->tv_sec, &cts->tv_sec) ||
|
||||
|
@@ -173,7 +173,7 @@ err_unlock:
|
||||
}
|
||||
|
||||
COMPAT_SYSCALL_DEFINE6(futex, u32 __user *, uaddr, int, op, u32, val,
|
||||
struct compat_timespec __user *, utime, u32 __user *, uaddr2,
|
||||
struct old_timespec32 __user *, utime, u32 __user *, uaddr2,
|
||||
u32, val3)
|
||||
{
|
||||
struct timespec ts;
|
||||
|
@@ -5244,7 +5244,7 @@ out_unlock:
|
||||
* an error code.
|
||||
*/
|
||||
SYSCALL_DEFINE2(sched_rr_get_interval, pid_t, pid,
|
||||
struct timespec __user *, interval)
|
||||
struct __kernel_timespec __user *, interval)
|
||||
{
|
||||
struct timespec64 t;
|
||||
int retval = sched_rr_get_interval(pid, &t);
|
||||
@@ -5255,16 +5255,16 @@ SYSCALL_DEFINE2(sched_rr_get_interval, pid_t, pid,
|
||||
return retval;
|
||||
}
|
||||
|
||||
#ifdef CONFIG_COMPAT
|
||||
#ifdef CONFIG_COMPAT_32BIT_TIME
|
||||
COMPAT_SYSCALL_DEFINE2(sched_rr_get_interval,
|
||||
compat_pid_t, pid,
|
||||
struct compat_timespec __user *, interval)
|
||||
struct old_timespec32 __user *, interval)
|
||||
{
|
||||
struct timespec64 t;
|
||||
int retval = sched_rr_get_interval(pid, &t);
|
||||
|
||||
if (retval == 0)
|
||||
retval = compat_put_timespec64(&t, interval);
|
||||
retval = put_old_timespec32(&t, interval);
|
||||
return retval;
|
||||
}
|
||||
#endif
|
||||
|
@@ -3165,7 +3165,7 @@ int copy_siginfo_from_user32(struct kernel_siginfo *to,
|
||||
* @ts: upper bound on process time suspension
|
||||
*/
|
||||
static int do_sigtimedwait(const sigset_t *which, kernel_siginfo_t *info,
|
||||
const struct timespec *ts)
|
||||
const struct timespec64 *ts)
|
||||
{
|
||||
ktime_t *to = NULL, timeout = KTIME_MAX;
|
||||
struct task_struct *tsk = current;
|
||||
@@ -3173,9 +3173,9 @@ static int do_sigtimedwait(const sigset_t *which, kernel_siginfo_t *info,
|
||||
int sig, ret = 0;
|
||||
|
||||
if (ts) {
|
||||
if (!timespec_valid(ts))
|
||||
if (!timespec64_valid(ts))
|
||||
return -EINVAL;
|
||||
timeout = timespec_to_ktime(*ts);
|
||||
timeout = timespec64_to_ktime(*ts);
|
||||
to = &timeout;
|
||||
}
|
||||
|
||||
@@ -3223,11 +3223,12 @@ static int do_sigtimedwait(const sigset_t *which, kernel_siginfo_t *info,
|
||||
* @sigsetsize: size of sigset_t type
|
||||
*/
|
||||
SYSCALL_DEFINE4(rt_sigtimedwait, const sigset_t __user *, uthese,
|
||||
siginfo_t __user *, uinfo, const struct timespec __user *, uts,
|
||||
siginfo_t __user *, uinfo,
|
||||
const struct __kernel_timespec __user *, uts,
|
||||
size_t, sigsetsize)
|
||||
{
|
||||
sigset_t these;
|
||||
struct timespec ts;
|
||||
struct timespec64 ts;
|
||||
kernel_siginfo_t info;
|
||||
int ret;
|
||||
|
||||
@@ -3239,7 +3240,7 @@ SYSCALL_DEFINE4(rt_sigtimedwait, const sigset_t __user *, uthese,
|
||||
return -EFAULT;
|
||||
|
||||
if (uts) {
|
||||
if (copy_from_user(&ts, uts, sizeof(ts)))
|
||||
if (get_timespec64(&ts, uts))
|
||||
return -EFAULT;
|
||||
}
|
||||
|
||||
@@ -3256,10 +3257,10 @@ SYSCALL_DEFINE4(rt_sigtimedwait, const sigset_t __user *, uthese,
|
||||
#ifdef CONFIG_COMPAT
|
||||
COMPAT_SYSCALL_DEFINE4(rt_sigtimedwait, compat_sigset_t __user *, uthese,
|
||||
struct compat_siginfo __user *, uinfo,
|
||||
struct compat_timespec __user *, uts, compat_size_t, sigsetsize)
|
||||
struct old_timespec32 __user *, uts, compat_size_t, sigsetsize)
|
||||
{
|
||||
sigset_t s;
|
||||
struct timespec t;
|
||||
struct timespec64 t;
|
||||
kernel_siginfo_t info;
|
||||
long ret;
|
||||
|
||||
@@ -3270,7 +3271,7 @@ COMPAT_SYSCALL_DEFINE4(rt_sigtimedwait, compat_sigset_t __user *, uthese,
|
||||
return -EFAULT;
|
||||
|
||||
if (uts) {
|
||||
if (compat_get_timespec(&t, uts))
|
||||
if (get_old_timespec32(&t, uts))
|
||||
return -EFAULT;
|
||||
}
|
||||
|
||||
|
@@ -1660,7 +1660,7 @@ int nanosleep_copyout(struct restart_block *restart, struct timespec64 *ts)
|
||||
switch(restart->nanosleep.type) {
|
||||
#ifdef CONFIG_COMPAT_32BIT_TIME
|
||||
case TT_COMPAT:
|
||||
if (compat_put_timespec64(ts, restart->nanosleep.compat_rmtp))
|
||||
if (put_old_timespec32(ts, restart->nanosleep.compat_rmtp))
|
||||
return -EFAULT;
|
||||
break;
|
||||
#endif
|
||||
@@ -1780,12 +1780,12 @@ SYSCALL_DEFINE2(nanosleep, struct __kernel_timespec __user *, rqtp,
|
||||
|
||||
#ifdef CONFIG_COMPAT_32BIT_TIME
|
||||
|
||||
COMPAT_SYSCALL_DEFINE2(nanosleep, struct compat_timespec __user *, rqtp,
|
||||
struct compat_timespec __user *, rmtp)
|
||||
COMPAT_SYSCALL_DEFINE2(nanosleep, struct old_timespec32 __user *, rqtp,
|
||||
struct old_timespec32 __user *, rmtp)
|
||||
{
|
||||
struct timespec64 tu;
|
||||
|
||||
if (compat_get_timespec64(&tu, rqtp))
|
||||
if (get_old_timespec32(&tu, rqtp))
|
||||
return -EFAULT;
|
||||
|
||||
if (!timespec64_valid(&tu))
|
||||
|
@@ -162,20 +162,20 @@ COMPAT_SYS_NI(setitimer);
|
||||
|
||||
#ifdef CONFIG_COMPAT_32BIT_TIME
|
||||
COMPAT_SYSCALL_DEFINE2(clock_settime, const clockid_t, which_clock,
|
||||
struct compat_timespec __user *, tp)
|
||||
struct old_timespec32 __user *, tp)
|
||||
{
|
||||
struct timespec64 new_tp;
|
||||
|
||||
if (which_clock != CLOCK_REALTIME)
|
||||
return -EINVAL;
|
||||
if (compat_get_timespec64(&new_tp, tp))
|
||||
if (get_old_timespec32(&new_tp, tp))
|
||||
return -EFAULT;
|
||||
|
||||
return do_sys_settimeofday64(&new_tp, NULL);
|
||||
}
|
||||
|
||||
COMPAT_SYSCALL_DEFINE2(clock_gettime, clockid_t, which_clock,
|
||||
struct compat_timespec __user *, tp)
|
||||
struct old_timespec32 __user *, tp)
|
||||
{
|
||||
int ret;
|
||||
struct timespec64 kernel_tp;
|
||||
@@ -184,13 +184,13 @@ COMPAT_SYSCALL_DEFINE2(clock_gettime, clockid_t, which_clock,
|
||||
if (ret)
|
||||
return ret;
|
||||
|
||||
if (compat_put_timespec64(&kernel_tp, tp))
|
||||
if (put_old_timespec32(&kernel_tp, tp))
|
||||
return -EFAULT;
|
||||
return 0;
|
||||
}
|
||||
|
||||
COMPAT_SYSCALL_DEFINE2(clock_getres, clockid_t, which_clock,
|
||||
struct compat_timespec __user *, tp)
|
||||
struct old_timespec32 __user *, tp)
|
||||
{
|
||||
struct timespec64 rtn_tp = {
|
||||
.tv_sec = 0,
|
||||
@@ -201,7 +201,7 @@ COMPAT_SYSCALL_DEFINE2(clock_getres, clockid_t, which_clock,
|
||||
case CLOCK_REALTIME:
|
||||
case CLOCK_MONOTONIC:
|
||||
case CLOCK_BOOTTIME:
|
||||
if (compat_put_timespec64(&rtn_tp, tp))
|
||||
if (put_old_timespec32(&rtn_tp, tp))
|
||||
return -EFAULT;
|
||||
return 0;
|
||||
default:
|
||||
@@ -210,8 +210,8 @@ COMPAT_SYSCALL_DEFINE2(clock_getres, clockid_t, which_clock,
|
||||
}
|
||||
|
||||
COMPAT_SYSCALL_DEFINE4(clock_nanosleep, clockid_t, which_clock, int, flags,
|
||||
struct compat_timespec __user *, rqtp,
|
||||
struct compat_timespec __user *, rmtp)
|
||||
struct old_timespec32 __user *, rqtp,
|
||||
struct old_timespec32 __user *, rmtp)
|
||||
{
|
||||
struct timespec64 t;
|
||||
|
||||
@@ -224,7 +224,7 @@ COMPAT_SYSCALL_DEFINE4(clock_nanosleep, clockid_t, which_clock, int, flags,
|
||||
return -EINVAL;
|
||||
}
|
||||
|
||||
if (compat_get_timespec64(&t, rqtp))
|
||||
if (get_old_timespec32(&t, rqtp))
|
||||
return -EFAULT;
|
||||
if (!timespec64_valid(&t))
|
||||
return -EINVAL;
|
||||
|
@@ -755,13 +755,13 @@ SYSCALL_DEFINE2(timer_gettime, timer_t, timer_id,
|
||||
#ifdef CONFIG_COMPAT_32BIT_TIME
|
||||
|
||||
COMPAT_SYSCALL_DEFINE2(timer_gettime, timer_t, timer_id,
|
||||
struct compat_itimerspec __user *, setting)
|
||||
struct old_itimerspec32 __user *, setting)
|
||||
{
|
||||
struct itimerspec64 cur_setting;
|
||||
|
||||
int ret = do_timer_gettime(timer_id, &cur_setting);
|
||||
if (!ret) {
|
||||
if (put_compat_itimerspec64(&cur_setting, setting))
|
||||
if (put_old_itimerspec32(&cur_setting, setting))
|
||||
ret = -EFAULT;
|
||||
}
|
||||
return ret;
|
||||
@@ -928,8 +928,8 @@ SYSCALL_DEFINE4(timer_settime, timer_t, timer_id, int, flags,
|
||||
|
||||
#ifdef CONFIG_COMPAT_32BIT_TIME
|
||||
COMPAT_SYSCALL_DEFINE4(timer_settime, timer_t, timer_id, int, flags,
|
||||
struct compat_itimerspec __user *, new,
|
||||
struct compat_itimerspec __user *, old)
|
||||
struct old_itimerspec32 __user *, new,
|
||||
struct old_itimerspec32 __user *, old)
|
||||
{
|
||||
struct itimerspec64 new_spec, old_spec;
|
||||
struct itimerspec64 *rtn = old ? &old_spec : NULL;
|
||||
@@ -937,12 +937,12 @@ COMPAT_SYSCALL_DEFINE4(timer_settime, timer_t, timer_id, int, flags,
|
||||
|
||||
if (!new)
|
||||
return -EINVAL;
|
||||
if (get_compat_itimerspec64(&new_spec, new))
|
||||
if (get_old_itimerspec32(&new_spec, new))
|
||||
return -EFAULT;
|
||||
|
||||
error = do_timer_settime(timer_id, flags, &new_spec, rtn);
|
||||
if (!error && old) {
|
||||
if (put_compat_itimerspec64(&old_spec, old))
|
||||
if (put_old_itimerspec32(&old_spec, old))
|
||||
error = -EFAULT;
|
||||
}
|
||||
return error;
|
||||
@@ -1115,7 +1115,7 @@ SYSCALL_DEFINE2(clock_getres, const clockid_t, which_clock,
|
||||
#ifdef CONFIG_COMPAT_32BIT_TIME
|
||||
|
||||
COMPAT_SYSCALL_DEFINE2(clock_settime, clockid_t, which_clock,
|
||||
struct compat_timespec __user *, tp)
|
||||
struct old_timespec32 __user *, tp)
|
||||
{
|
||||
const struct k_clock *kc = clockid_to_kclock(which_clock);
|
||||
struct timespec64 ts;
|
||||
@@ -1123,14 +1123,14 @@ COMPAT_SYSCALL_DEFINE2(clock_settime, clockid_t, which_clock,
|
||||
if (!kc || !kc->clock_set)
|
||||
return -EINVAL;
|
||||
|
||||
if (compat_get_timespec64(&ts, tp))
|
||||
if (get_old_timespec32(&ts, tp))
|
||||
return -EFAULT;
|
||||
|
||||
return kc->clock_set(which_clock, &ts);
|
||||
}
|
||||
|
||||
COMPAT_SYSCALL_DEFINE2(clock_gettime, clockid_t, which_clock,
|
||||
struct compat_timespec __user *, tp)
|
||||
struct old_timespec32 __user *, tp)
|
||||
{
|
||||
const struct k_clock *kc = clockid_to_kclock(which_clock);
|
||||
struct timespec64 ts;
|
||||
@@ -1141,7 +1141,7 @@ COMPAT_SYSCALL_DEFINE2(clock_gettime, clockid_t, which_clock,
|
||||
|
||||
err = kc->clock_get(which_clock, &ts);
|
||||
|
||||
if (!err && compat_put_timespec64(&ts, tp))
|
||||
if (!err && put_old_timespec32(&ts, tp))
|
||||
err = -EFAULT;
|
||||
|
||||
return err;
|
||||
@@ -1180,7 +1180,7 @@ COMPAT_SYSCALL_DEFINE2(clock_adjtime, clockid_t, which_clock,
|
||||
#ifdef CONFIG_COMPAT_32BIT_TIME
|
||||
|
||||
COMPAT_SYSCALL_DEFINE2(clock_getres, clockid_t, which_clock,
|
||||
struct compat_timespec __user *, tp)
|
||||
struct old_timespec32 __user *, tp)
|
||||
{
|
||||
const struct k_clock *kc = clockid_to_kclock(which_clock);
|
||||
struct timespec64 ts;
|
||||
@@ -1190,7 +1190,7 @@ COMPAT_SYSCALL_DEFINE2(clock_getres, clockid_t, which_clock,
|
||||
return -EINVAL;
|
||||
|
||||
err = kc->clock_getres(which_clock, &ts);
|
||||
if (!err && tp && compat_put_timespec64(&ts, tp))
|
||||
if (!err && tp && put_old_timespec32(&ts, tp))
|
||||
return -EFAULT;
|
||||
|
||||
return err;
|
||||
@@ -1237,8 +1237,8 @@ SYSCALL_DEFINE4(clock_nanosleep, const clockid_t, which_clock, int, flags,
|
||||
#ifdef CONFIG_COMPAT_32BIT_TIME
|
||||
|
||||
COMPAT_SYSCALL_DEFINE4(clock_nanosleep, clockid_t, which_clock, int, flags,
|
||||
struct compat_timespec __user *, rqtp,
|
||||
struct compat_timespec __user *, rmtp)
|
||||
struct old_timespec32 __user *, rqtp,
|
||||
struct old_timespec32 __user *, rmtp)
|
||||
{
|
||||
const struct k_clock *kc = clockid_to_kclock(which_clock);
|
||||
struct timespec64 t;
|
||||
@@ -1248,7 +1248,7 @@ COMPAT_SYSCALL_DEFINE4(clock_nanosleep, clockid_t, which_clock, int, flags,
|
||||
if (!kc->nsleep)
|
||||
return -EOPNOTSUPP;
|
||||
|
||||
if (compat_get_timespec64(&t, rqtp))
|
||||
if (get_old_timespec32(&t, rqtp))
|
||||
return -EFAULT;
|
||||
|
||||
if (!timespec64_valid(&t))
|
||||
|
@@ -400,8 +400,6 @@ void tick_broadcast_control(enum tick_broadcast_mode mode)
|
||||
if (tick_broadcast_forced)
|
||||
break;
|
||||
cpumask_clear_cpu(cpu, tick_broadcast_on);
|
||||
if (!tick_device_is_functional(dev))
|
||||
break;
|
||||
if (cpumask_test_and_clear_cpu(cpu, tick_broadcast_mask)) {
|
||||
if (tick_broadcast_device.mode ==
|
||||
TICKDEV_MODE_PERIODIC)
|
||||
|
@@ -885,7 +885,7 @@ static bool can_stop_idle_tick(int cpu, struct tick_sched *ts)
|
||||
if (need_resched())
|
||||
return false;
|
||||
|
||||
if (unlikely(local_softirq_pending() && cpu_online(cpu))) {
|
||||
if (unlikely(local_softirq_pending())) {
|
||||
static int ratelimit;
|
||||
|
||||
if (ratelimit < 10 &&
|
||||
|
@@ -104,12 +104,12 @@ SYSCALL_DEFINE1(stime, time_t __user *, tptr)
|
||||
#ifdef CONFIG_COMPAT
|
||||
#ifdef __ARCH_WANT_COMPAT_SYS_TIME
|
||||
|
||||
/* compat_time_t is a 32 bit "long" and needs to get converted. */
|
||||
COMPAT_SYSCALL_DEFINE1(time, compat_time_t __user *, tloc)
|
||||
/* old_time32_t is a 32 bit "long" and needs to get converted. */
|
||||
COMPAT_SYSCALL_DEFINE1(time, old_time32_t __user *, tloc)
|
||||
{
|
||||
compat_time_t i;
|
||||
old_time32_t i;
|
||||
|
||||
i = (compat_time_t)ktime_get_real_seconds();
|
||||
i = (old_time32_t)ktime_get_real_seconds();
|
||||
|
||||
if (tloc) {
|
||||
if (put_user(i,tloc))
|
||||
@@ -119,7 +119,7 @@ COMPAT_SYSCALL_DEFINE1(time, compat_time_t __user *, tloc)
|
||||
return i;
|
||||
}
|
||||
|
||||
COMPAT_SYSCALL_DEFINE1(stime, compat_time_t __user *, tptr)
|
||||
COMPAT_SYSCALL_DEFINE1(stime, old_time32_t __user *, tptr)
|
||||
{
|
||||
struct timespec64 tv;
|
||||
int err;
|
||||
@@ -144,9 +144,11 @@ SYSCALL_DEFINE2(gettimeofday, struct timeval __user *, tv,
|
||||
struct timezone __user *, tz)
|
||||
{
|
||||
if (likely(tv != NULL)) {
|
||||
struct timeval ktv;
|
||||
do_gettimeofday(&ktv);
|
||||
if (copy_to_user(tv, &ktv, sizeof(ktv)))
|
||||
struct timespec64 ts;
|
||||
|
||||
ktime_get_real_ts64(&ts);
|
||||
if (put_user(ts.tv_sec, &tv->tv_sec) ||
|
||||
put_user(ts.tv_nsec / 1000, &tv->tv_usec))
|
||||
return -EFAULT;
|
||||
}
|
||||
if (unlikely(tz != NULL)) {
|
||||
@@ -223,14 +225,15 @@ SYSCALL_DEFINE2(settimeofday, struct timeval __user *, tv,
|
||||
}
|
||||
|
||||
#ifdef CONFIG_COMPAT
|
||||
COMPAT_SYSCALL_DEFINE2(gettimeofday, struct compat_timeval __user *, tv,
|
||||
COMPAT_SYSCALL_DEFINE2(gettimeofday, struct old_timeval32 __user *, tv,
|
||||
struct timezone __user *, tz)
|
||||
{
|
||||
if (tv) {
|
||||
struct timeval ktv;
|
||||
struct timespec64 ts;
|
||||
|
||||
do_gettimeofday(&ktv);
|
||||
if (compat_put_timeval(&ktv, tv))
|
||||
ktime_get_real_ts64(&ts);
|
||||
if (put_user(ts.tv_sec, &tv->tv_sec) ||
|
||||
put_user(ts.tv_nsec / 1000, &tv->tv_usec))
|
||||
return -EFAULT;
|
||||
}
|
||||
if (tz) {
|
||||
@@ -241,7 +244,7 @@ COMPAT_SYSCALL_DEFINE2(gettimeofday, struct compat_timeval __user *, tv,
|
||||
return 0;
|
||||
}
|
||||
|
||||
COMPAT_SYSCALL_DEFINE2(settimeofday, struct compat_timeval __user *, tv,
|
||||
COMPAT_SYSCALL_DEFINE2(settimeofday, struct old_timeval32 __user *, tv,
|
||||
struct timezone __user *, tz)
|
||||
{
|
||||
struct timespec64 new_ts;
|
||||
@@ -342,30 +345,6 @@ unsigned int jiffies_to_usecs(const unsigned long j)
|
||||
}
|
||||
EXPORT_SYMBOL(jiffies_to_usecs);
|
||||
|
||||
/**
|
||||
* timespec_trunc - Truncate timespec to a granularity
|
||||
* @t: Timespec
|
||||
* @gran: Granularity in ns.
|
||||
*
|
||||
* Truncate a timespec to a granularity. Always rounds down. gran must
|
||||
* not be 0 nor greater than a second (NSEC_PER_SEC, or 10^9 ns).
|
||||
*/
|
||||
struct timespec timespec_trunc(struct timespec t, unsigned gran)
|
||||
{
|
||||
/* Avoid division in the common cases 1 ns and 1 s. */
|
||||
if (gran == 1) {
|
||||
/* nothing */
|
||||
} else if (gran == NSEC_PER_SEC) {
|
||||
t.tv_nsec = 0;
|
||||
} else if (gran > 1 && gran < NSEC_PER_SEC) {
|
||||
t.tv_nsec -= t.tv_nsec % gran;
|
||||
} else {
|
||||
WARN(1, "illegal file time granularity: %u", gran);
|
||||
}
|
||||
return t;
|
||||
}
|
||||
EXPORT_SYMBOL(timespec_trunc);
|
||||
|
||||
/*
|
||||
* mktime64 - Converts date to seconds.
|
||||
* Converts Gregorian date to seconds since 1970-01-01 00:00:00.
|
||||
@@ -884,10 +863,10 @@ int put_timespec64(const struct timespec64 *ts,
|
||||
}
|
||||
EXPORT_SYMBOL_GPL(put_timespec64);
|
||||
|
||||
int __compat_get_timespec64(struct timespec64 *ts64,
|
||||
const struct compat_timespec __user *cts)
|
||||
static int __get_old_timespec32(struct timespec64 *ts64,
|
||||
const struct old_timespec32 __user *cts)
|
||||
{
|
||||
struct compat_timespec ts;
|
||||
struct old_timespec32 ts;
|
||||
int ret;
|
||||
|
||||
ret = copy_from_user(&ts, cts, sizeof(ts));
|
||||
@@ -900,33 +879,33 @@ int __compat_get_timespec64(struct timespec64 *ts64,
|
||||
return 0;
|
||||
}
|
||||
|
||||
int __compat_put_timespec64(const struct timespec64 *ts64,
|
||||
struct compat_timespec __user *cts)
|
||||
static int __put_old_timespec32(const struct timespec64 *ts64,
|
||||
struct old_timespec32 __user *cts)
|
||||
{
|
||||
struct compat_timespec ts = {
|
||||
struct old_timespec32 ts = {
|
||||
.tv_sec = ts64->tv_sec,
|
||||
.tv_nsec = ts64->tv_nsec
|
||||
};
|
||||
return copy_to_user(cts, &ts, sizeof(ts)) ? -EFAULT : 0;
|
||||
}
|
||||
|
||||
int compat_get_timespec64(struct timespec64 *ts, const void __user *uts)
|
||||
int get_old_timespec32(struct timespec64 *ts, const void __user *uts)
|
||||
{
|
||||
if (COMPAT_USE_64BIT_TIME)
|
||||
return copy_from_user(ts, uts, sizeof(*ts)) ? -EFAULT : 0;
|
||||
else
|
||||
return __compat_get_timespec64(ts, uts);
|
||||
return __get_old_timespec32(ts, uts);
|
||||
}
|
||||
EXPORT_SYMBOL_GPL(compat_get_timespec64);
|
||||
EXPORT_SYMBOL_GPL(get_old_timespec32);
|
||||
|
||||
int compat_put_timespec64(const struct timespec64 *ts, void __user *uts)
|
||||
int put_old_timespec32(const struct timespec64 *ts, void __user *uts)
|
||||
{
|
||||
if (COMPAT_USE_64BIT_TIME)
|
||||
return copy_to_user(uts, ts, sizeof(*ts)) ? -EFAULT : 0;
|
||||
else
|
||||
return __compat_put_timespec64(ts, uts);
|
||||
return __put_old_timespec32(ts, uts);
|
||||
}
|
||||
EXPORT_SYMBOL_GPL(compat_put_timespec64);
|
||||
EXPORT_SYMBOL_GPL(put_old_timespec32);
|
||||
|
||||
int get_itimerspec64(struct itimerspec64 *it,
|
||||
const struct __kernel_itimerspec __user *uit)
|
||||
@@ -958,23 +937,23 @@ int put_itimerspec64(const struct itimerspec64 *it,
|
||||
}
|
||||
EXPORT_SYMBOL_GPL(put_itimerspec64);
|
||||
|
||||
int get_compat_itimerspec64(struct itimerspec64 *its,
|
||||
const struct compat_itimerspec __user *uits)
|
||||
int get_old_itimerspec32(struct itimerspec64 *its,
|
||||
const struct old_itimerspec32 __user *uits)
|
||||
{
|
||||
|
||||
if (__compat_get_timespec64(&its->it_interval, &uits->it_interval) ||
|
||||
__compat_get_timespec64(&its->it_value, &uits->it_value))
|
||||
if (__get_old_timespec32(&its->it_interval, &uits->it_interval) ||
|
||||
__get_old_timespec32(&its->it_value, &uits->it_value))
|
||||
return -EFAULT;
|
||||
return 0;
|
||||
}
|
||||
EXPORT_SYMBOL_GPL(get_compat_itimerspec64);
|
||||
EXPORT_SYMBOL_GPL(get_old_itimerspec32);
|
||||
|
||||
int put_compat_itimerspec64(const struct itimerspec64 *its,
|
||||
struct compat_itimerspec __user *uits)
|
||||
int put_old_itimerspec32(const struct itimerspec64 *its,
|
||||
struct old_itimerspec32 __user *uits)
|
||||
{
|
||||
if (__compat_put_timespec64(&its->it_interval, &uits->it_interval) ||
|
||||
__compat_put_timespec64(&its->it_value, &uits->it_value))
|
||||
if (__put_old_timespec32(&its->it_interval, &uits->it_interval) ||
|
||||
__put_old_timespec32(&its->it_value, &uits->it_value))
|
||||
return -EFAULT;
|
||||
return 0;
|
||||
}
|
||||
EXPORT_SYMBOL_GPL(put_compat_itimerspec64);
|
||||
EXPORT_SYMBOL_GPL(put_old_itimerspec32);
|
||||
|
@@ -1211,22 +1211,6 @@ int get_device_system_crosststamp(int (*get_time_fn)
|
||||
}
|
||||
EXPORT_SYMBOL_GPL(get_device_system_crosststamp);
|
||||
|
||||
/**
|
||||
* do_gettimeofday - Returns the time of day in a timeval
|
||||
* @tv: pointer to the timeval to be set
|
||||
*
|
||||
* NOTE: Users should be converted to using getnstimeofday()
|
||||
*/
|
||||
void do_gettimeofday(struct timeval *tv)
|
||||
{
|
||||
struct timespec64 now;
|
||||
|
||||
getnstimeofday64(&now);
|
||||
tv->tv_sec = now.tv_sec;
|
||||
tv->tv_usec = now.tv_nsec/1000;
|
||||
}
|
||||
EXPORT_SYMBOL(do_gettimeofday);
|
||||
|
||||
/**
|
||||
* do_settimeofday64 - Sets the time of day.
|
||||
* @ts: pointer to the timespec64 variable containing the new time
|
||||
@@ -2174,14 +2158,6 @@ void getboottime64(struct timespec64 *ts)
|
||||
}
|
||||
EXPORT_SYMBOL_GPL(getboottime64);
|
||||
|
||||
unsigned long get_seconds(void)
|
||||
{
|
||||
struct timekeeper *tk = &tk_core.timekeeper;
|
||||
|
||||
return tk->xtime_sec;
|
||||
}
|
||||
EXPORT_SYMBOL(get_seconds);
|
||||
|
||||
void ktime_get_coarse_real_ts64(struct timespec64 *ts)
|
||||
{
|
||||
struct timekeeper *tk = &tk_core.timekeeper;
|
||||
|
Reference in New Issue
Block a user