Skip to content

Commit bde9e96

Browse files
committed
y2038: timerfd: Use timespec64 internally
timerfd_show() uses a 'struct itimerspec' internally, but that is deprecated because of the time_t overflow and a conflict with the glibc type of the same name that is now incompatible in user space. Use a pair of timespec64 variables instead as a simple replacement. As this removes the last use of itimerspec from the kernel, allowing the removal of the definition from the uapi headers along with timespec and timeval later. Reviewed-by: Thomas Gleixner <[email protected]> Signed-off-by: Arnd Bergmann <[email protected]>
1 parent e2bb80d commit bde9e96

File tree

1 file changed

+7
-7
lines changed

1 file changed

+7
-7
lines changed

fs/timerfd.c

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -302,11 +302,11 @@ static ssize_t timerfd_read(struct file *file, char __user *buf, size_t count,
302302
static void timerfd_show(struct seq_file *m, struct file *file)
303303
{
304304
struct timerfd_ctx *ctx = file->private_data;
305-
struct itimerspec t;
305+
struct timespec64 value, interval;
306306

307307
spin_lock_irq(&ctx->wqh.lock);
308-
t.it_value = ktime_to_timespec(timerfd_get_remaining(ctx));
309-
t.it_interval = ktime_to_timespec(ctx->tintv);
308+
value = ktime_to_timespec64(timerfd_get_remaining(ctx));
309+
interval = ktime_to_timespec64(ctx->tintv);
310310
spin_unlock_irq(&ctx->wqh.lock);
311311

312312
seq_printf(m,
@@ -318,10 +318,10 @@ static void timerfd_show(struct seq_file *m, struct file *file)
318318
ctx->clockid,
319319
(unsigned long long)ctx->ticks,
320320
ctx->settime_flags,
321-
(unsigned long long)t.it_value.tv_sec,
322-
(unsigned long long)t.it_value.tv_nsec,
323-
(unsigned long long)t.it_interval.tv_sec,
324-
(unsigned long long)t.it_interval.tv_nsec);
321+
(unsigned long long)value.tv_sec,
322+
(unsigned long long)value.tv_nsec,
323+
(unsigned long long)interval.tv_sec,
324+
(unsigned long long)interval.tv_nsec);
325325
}
326326
#else
327327
#define timerfd_show NULL

0 commit comments

Comments
 (0)