Commit 2a785996 authored by Arnd Bergmann's avatar Arnd Bergmann

y2038: uapi: change __kernel_time_t to __kernel_old_time_t

This is mainly a patch for clarification, and to let us remove
the time_t definition from the kernel to prevent new users from
creeping in that might not be y2038-safe.

All remaining uses of 'time_t' or '__kernel_time_t' are part of
the user API that cannot be changed by that either have a
replacement or that do not suffer from the y2038 overflow.
Acked-by: default avatarDeepa Dinamani <deepa.kernel@gmail.com>
Acked-by: default avatarChristian Brauner <christian.brauner@ubuntu.com>
Signed-off-by: default avatarArnd Bergmann <arnd@arndb.de>
parent 1bf883c1
...@@ -1076,7 +1076,7 @@ asmlinkage long sys_fadvise64(int fd, loff_t offset, size_t len, int advice); ...@@ -1076,7 +1076,7 @@ asmlinkage long sys_fadvise64(int fd, loff_t offset, size_t len, int advice);
asmlinkage long sys_alarm(unsigned int seconds); asmlinkage long sys_alarm(unsigned int seconds);
asmlinkage long sys_getpgrp(void); asmlinkage long sys_getpgrp(void);
asmlinkage long sys_pause(void); asmlinkage long sys_pause(void);
asmlinkage long sys_time(time_t __user *tloc); asmlinkage long sys_time(__kernel_old_time_t __user *tloc);
asmlinkage long sys_time32(old_time32_t __user *tloc); asmlinkage long sys_time32(old_time32_t __user *tloc);
#ifdef __ARCH_WANT_SYS_UTIME #ifdef __ARCH_WANT_SYS_UTIME
asmlinkage long sys_utime(char __user *filename, asmlinkage long sys_utime(char __user *filename,
...@@ -1116,7 +1116,7 @@ asmlinkage long sys_sysfs(int option, ...@@ -1116,7 +1116,7 @@ asmlinkage long sys_sysfs(int option,
asmlinkage long sys_fork(void); asmlinkage long sys_fork(void);
/* obsolete: kernel/time/time.c */ /* obsolete: kernel/time/time.c */
asmlinkage long sys_stime(time_t __user *tptr); asmlinkage long sys_stime(__kernel_old_time_t __user *tptr);
asmlinkage long sys_stime32(old_time32_t __user *tptr); asmlinkage long sys_stime32(old_time32_t __user *tptr);
/* obsolete: kernel/signal.c */ /* obsolete: kernel/signal.c */
......
...@@ -12,7 +12,7 @@ ...@@ -12,7 +12,7 @@
#include <linux/time64.h> #include <linux/time64.h>
#include <linux/timex.h> #include <linux/timex.h>
#define TIME_T_MAX (time_t)((1UL << ((sizeof(time_t) << 3) - 1)) - 1) #define TIME_T_MAX (__kernel_old_time_t)((1UL << ((sizeof(__kernel_old_time_t) << 3) - 1)) - 1)
typedef s32 old_time32_t; typedef s32 old_time32_t;
......
...@@ -67,7 +67,7 @@ typedef __kernel_ptrdiff_t ptrdiff_t; ...@@ -67,7 +67,7 @@ typedef __kernel_ptrdiff_t ptrdiff_t;
#ifndef _TIME_T #ifndef _TIME_T
#define _TIME_T #define _TIME_T
typedef __kernel_time_t time_t; typedef __kernel_old_time_t time_t;
#endif #endif
#ifndef _CLOCK_T #ifndef _CLOCK_T
......
...@@ -83,9 +83,9 @@ struct cyclades_monitor { ...@@ -83,9 +83,9 @@ struct cyclades_monitor {
* open) * open)
*/ */
struct cyclades_idle_stats { struct cyclades_idle_stats {
__kernel_time_t in_use; /* Time device has been in use (secs) */ __kernel_old_time_t in_use; /* Time device has been in use (secs) */
__kernel_time_t recv_idle; /* Time since last char received (secs) */ __kernel_old_time_t recv_idle; /* Time since last char received (secs) */
__kernel_time_t xmit_idle; /* Time since last char transmitted (secs) */ __kernel_old_time_t xmit_idle; /* Time since last char transmitted (secs) */
unsigned long recv_bytes; /* Bytes received */ unsigned long recv_bytes; /* Bytes received */
unsigned long xmit_bytes; /* Bytes transmitted */ unsigned long xmit_bytes; /* Bytes transmitted */
unsigned long overruns; /* Input overruns */ unsigned long overruns; /* Input overruns */
......
...@@ -19,9 +19,9 @@ struct msqid_ds { ...@@ -19,9 +19,9 @@ struct msqid_ds {
struct ipc_perm msg_perm; struct ipc_perm msg_perm;
struct msg *msg_first; /* first message on queue,unused */ struct msg *msg_first; /* first message on queue,unused */
struct msg *msg_last; /* last message in queue,unused */ struct msg *msg_last; /* last message in queue,unused */
__kernel_time_t msg_stime; /* last msgsnd time */ __kernel_old_time_t msg_stime; /* last msgsnd time */
__kernel_time_t msg_rtime; /* last msgrcv time */ __kernel_old_time_t msg_rtime; /* last msgrcv time */
__kernel_time_t msg_ctime; /* last change time */ __kernel_old_time_t msg_ctime; /* last change time */
unsigned long msg_lcbytes; /* Reuse junk fields for 32 bit */ unsigned long msg_lcbytes; /* Reuse junk fields for 32 bit */
unsigned long msg_lqbytes; /* ditto */ unsigned long msg_lqbytes; /* ditto */
unsigned short msg_cbytes; /* current number of bytes on queue */ unsigned short msg_cbytes; /* current number of bytes on queue */
......
...@@ -144,8 +144,8 @@ struct ppp_comp_stats { ...@@ -144,8 +144,8 @@ struct ppp_comp_stats {
* the last NP packet was sent or received. * the last NP packet was sent or received.
*/ */
struct ppp_idle { struct ppp_idle {
__kernel_time_t xmit_idle; /* time since last NP packet sent */ __kernel_old_time_t xmit_idle; /* time since last NP packet sent */
__kernel_time_t recv_idle; /* time since last NP packet received */ __kernel_old_time_t recv_idle; /* time since last NP packet received */
}; };
#endif /* _UAPI_PPP_DEFS_H_ */ #endif /* _UAPI_PPP_DEFS_H_ */
...@@ -24,8 +24,8 @@ ...@@ -24,8 +24,8 @@
/* Obsolete, used only for backwards compatibility and libc5 compiles */ /* Obsolete, used only for backwards compatibility and libc5 compiles */
struct semid_ds { struct semid_ds {
struct ipc_perm sem_perm; /* permissions .. see ipc.h */ struct ipc_perm sem_perm; /* permissions .. see ipc.h */
__kernel_time_t sem_otime; /* last semop time */ __kernel_old_time_t sem_otime; /* last semop time */
__kernel_time_t sem_ctime; /* create/last semctl() time */ __kernel_old_time_t sem_ctime; /* create/last semctl() time */
struct sem *sem_base; /* ptr to first semaphore in array */ struct sem *sem_base; /* ptr to first semaphore in array */
struct sem_queue *sem_pending; /* pending operations to be processed */ struct sem_queue *sem_pending; /* pending operations to be processed */
struct sem_queue **sem_pending_last; /* last pending operation */ struct sem_queue **sem_pending_last; /* last pending operation */
......
...@@ -28,9 +28,9 @@ ...@@ -28,9 +28,9 @@
struct shmid_ds { struct shmid_ds {
struct ipc_perm shm_perm; /* operation perms */ struct ipc_perm shm_perm; /* operation perms */
int shm_segsz; /* size of segment (bytes) */ int shm_segsz; /* size of segment (bytes) */
__kernel_time_t shm_atime; /* last attach time */ __kernel_old_time_t shm_atime; /* last attach time */
__kernel_time_t shm_dtime; /* last detach time */ __kernel_old_time_t shm_dtime; /* last detach time */
__kernel_time_t shm_ctime; /* last change time */ __kernel_old_time_t shm_ctime; /* last change time */
__kernel_ipc_pid_t shm_cpid; /* pid of creator */ __kernel_ipc_pid_t shm_cpid; /* pid of creator */
__kernel_ipc_pid_t shm_lpid; /* pid of last operator */ __kernel_ipc_pid_t shm_lpid; /* pid of last operator */
unsigned short shm_nattch; /* no. of current attaches */ unsigned short shm_nattch; /* no. of current attaches */
......
...@@ -8,13 +8,13 @@ ...@@ -8,13 +8,13 @@
#ifndef _STRUCT_TIMESPEC #ifndef _STRUCT_TIMESPEC
#define _STRUCT_TIMESPEC #define _STRUCT_TIMESPEC
struct timespec { struct timespec {
__kernel_time_t tv_sec; /* seconds */ __kernel_old_time_t tv_sec; /* seconds */
long tv_nsec; /* nanoseconds */ long tv_nsec; /* nanoseconds */
}; };
#endif #endif
struct timeval { struct timeval {
__kernel_time_t tv_sec; /* seconds */ __kernel_old_time_t tv_sec; /* seconds */
__kernel_suseconds_t tv_usec; /* microseconds */ __kernel_suseconds_t tv_usec; /* microseconds */
}; };
......
...@@ -29,8 +29,8 @@ struct __kernel_old_timeval { ...@@ -29,8 +29,8 @@ struct __kernel_old_timeval {
#endif #endif
struct __kernel_old_timespec { struct __kernel_old_timespec {
__kernel_time_t tv_sec; /* seconds */ __kernel_old_time_t tv_sec; /* seconds */
long tv_nsec; /* nanoseconds */ long tv_nsec; /* nanoseconds */
}; };
struct __kernel_sock_timeval { struct __kernel_sock_timeval {
......
...@@ -5,8 +5,8 @@ ...@@ -5,8 +5,8 @@
#include <linux/types.h> #include <linux/types.h>
struct utimbuf { struct utimbuf {
__kernel_time_t actime; __kernel_old_time_t actime;
__kernel_time_t modtime; __kernel_old_time_t modtime;
}; };
#endif #endif
...@@ -59,9 +59,9 @@ EXPORT_SYMBOL(sys_tz); ...@@ -59,9 +59,9 @@ EXPORT_SYMBOL(sys_tz);
* why not move it into the appropriate arch directory (for those * why not move it into the appropriate arch directory (for those
* architectures that need it). * architectures that need it).
*/ */
SYSCALL_DEFINE1(time, time_t __user *, tloc) SYSCALL_DEFINE1(time, __kernel_old_time_t __user *, tloc)
{ {
time_t i = (time_t)ktime_get_real_seconds(); __kernel_old_time_t i = (__kernel_old_time_t)ktime_get_real_seconds();
if (tloc) { if (tloc) {
if (put_user(i,tloc)) if (put_user(i,tloc))
...@@ -78,7 +78,7 @@ SYSCALL_DEFINE1(time, time_t __user *, tloc) ...@@ -78,7 +78,7 @@ SYSCALL_DEFINE1(time, time_t __user *, tloc)
* architectures that need it). * architectures that need it).
*/ */
SYSCALL_DEFINE1(stime, time_t __user *, tptr) SYSCALL_DEFINE1(stime, __kernel_old_time_t __user *, tptr)
{ {
struct timespec64 tv; struct timespec64 tv;
int err; int err;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment