aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorLinus Torvalds <torvalds@linux-foundation.org>2018-06-05 00:02:18 -0400
committerLinus Torvalds <torvalds@linux-foundation.org>2018-06-05 00:02:18 -0400
commitba252f16e4433e7599fec986e77722e6d0eed186 (patch)
tree01cdf643009b18091c8d8c7630accb5a82f01ba8
parent0bbcce5d1ef3f771a349896f1c7574d20dc6f4bd (diff)
parente27c49291a7fe9dc415c9fcab5bd781ec82dfe04 (diff)
Merge branch 'timers-2038-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip
Pull time/Y2038 updates from Thomas Gleixner: - Consolidate SySV IPC UAPI headers - Convert SySV IPC to the new COMPAT_32BIT_TIME mechanism - Cleanup the core interfaces and standardize on the ktime_get_* naming convention. - Convert the X86 platform ops to timespec64 - Remove the ugly temporary timespec64 hack * 'timers-2038-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip: (22 commits) x86: Convert x86_platform_ops to timespec64 timekeeping: Add more coarse clocktai/boottime interfaces timekeeping: Add ktime_get_coarse_with_offset timekeeping: Standardize on ktime_get_*() naming timekeeping: Clean up ktime_get_real_ts64 timekeeping: Remove timespec64 hack y2038: ipc: Redirect ipc(SEMTIMEDOP, ...) to compat_ksys_semtimedop y2038: ipc: Enable COMPAT_32BIT_TIME y2038: ipc: Use __kernel_timespec y2038: ipc: Report long times to user space y2038: ipc: Use ktime_get_real_seconds consistently y2038: xtensa: Extend sysvipc data structures y2038: powerpc: Extend sysvipc data structures y2038: sparc: Extend sysvipc data structures y2038: parisc: Extend sysvipc data structures y2038: mips: Extend sysvipc data structures y2038: arm64: Extend sysvipc compat data structures y2038: s390: Remove unneeded ipc uapi header files y2038: ia64: Remove unneeded ipc uapi header files y2038: alpha: Remove unneeded ipc uapi header files ...
-rw-r--r--arch/alpha/include/uapi/asm/Kbuild4
-rw-r--r--arch/alpha/include/uapi/asm/ipcbuf.h2
-rw-r--r--arch/alpha/include/uapi/asm/msgbuf.h28
-rw-r--r--arch/alpha/include/uapi/asm/sembuf.h23
-rw-r--r--arch/alpha/include/uapi/asm/shmbuf.h39
-rw-r--r--arch/arm64/include/asm/compat.h32
-rw-r--r--arch/ia64/include/uapi/asm/Kbuild4
-rw-r--r--arch/ia64/include/uapi/asm/ipcbuf.h2
-rw-r--r--arch/ia64/include/uapi/asm/msgbuf.h28
-rw-r--r--arch/ia64/include/uapi/asm/sembuf.h23
-rw-r--r--arch/ia64/include/uapi/asm/shmbuf.h39
-rw-r--r--arch/mips/include/asm/compat.h40
-rw-r--r--arch/mips/include/uapi/asm/msgbuf.h57
-rw-r--r--arch/mips/include/uapi/asm/sembuf.h15
-rw-r--r--arch/mips/include/uapi/asm/shmbuf.h23
-rw-r--r--arch/parisc/include/asm/compat.h32
-rw-r--r--arch/parisc/include/uapi/asm/msgbuf.h33
-rw-r--r--arch/parisc/include/uapi/asm/sembuf.h16
-rw-r--r--arch/parisc/include/uapi/asm/shmbuf.h19
-rw-r--r--arch/powerpc/include/asm/compat.h32
-rw-r--r--arch/powerpc/include/uapi/asm/msgbuf.h18
-rw-r--r--arch/powerpc/include/uapi/asm/sembuf.h14
-rw-r--r--arch/powerpc/include/uapi/asm/shmbuf.h19
-rw-r--r--arch/s390/include/asm/compat.h32
-rw-r--r--arch/s390/include/uapi/asm/Kbuild3
-rw-r--r--arch/s390/include/uapi/asm/msgbuf.h38
-rw-r--r--arch/s390/include/uapi/asm/sembuf.h30
-rw-r--r--arch/s390/include/uapi/asm/shmbuf.h49
-rw-r--r--arch/sparc/include/asm/compat.h32
-rw-r--r--arch/sparc/include/uapi/asm/msgbuf.h22
-rw-r--r--arch/sparc/include/uapi/asm/sembuf.h16
-rw-r--r--arch/sparc/include/uapi/asm/shmbuf.h21
-rw-r--r--arch/x86/include/asm/compat.h32
-rw-r--r--arch/x86/include/asm/intel_mid_vrtc.h4
-rw-r--r--arch/x86/include/asm/mc146818rtc.h4
-rw-r--r--arch/x86/include/asm/pvclock.h2
-rw-r--r--arch/x86/include/asm/x86_init.h6
-rw-r--r--arch/x86/include/uapi/asm/sembuf.h11
-rw-r--r--arch/x86/kernel/jailhouse.c2
-rw-r--r--arch/x86/kernel/kvmclock.c4
-rw-r--r--arch/x86/kernel/pvclock.c15
-rw-r--r--arch/x86/kernel/rtc.c10
-rw-r--r--arch/x86/platform/intel-mid/intel_mid_vrtc.c12
-rw-r--r--arch/x86/xen/time.c10
-rw-r--r--arch/xtensa/include/uapi/asm/msgbuf.h25
-rw-r--r--arch/xtensa/include/uapi/asm/sembuf.h17
-rw-r--r--arch/xtensa/include/uapi/asm/shmbuf.h37
-rw-r--r--include/linux/syscalls.h6
-rw-r--r--include/linux/time32.h18
-rw-r--r--include/linux/time64.h7
-rw-r--r--include/linux/timekeeping.h91
-rw-r--r--include/linux/timekeeping32.h70
-rw-r--r--include/uapi/asm-generic/msgbuf.h27
-rw-r--r--include/uapi/asm-generic/sembuf.h26
-rw-r--r--include/uapi/asm-generic/shmbuf.h41
-rw-r--r--ipc/mqueue.c86
-rw-r--r--ipc/msg.c20
-rw-r--r--ipc/sem.c27
-rw-r--r--ipc/shm.c14
-rw-r--r--ipc/syscall.c13
-rw-r--r--ipc/util.h4
-rw-r--r--kernel/time/time.c2
-rw-r--r--kernel/time/timekeeping.c73
63 files changed, 633 insertions, 868 deletions
diff --git a/arch/alpha/include/uapi/asm/Kbuild b/arch/alpha/include/uapi/asm/Kbuild
index 9afaba5e5503..1a5b75310cf4 100644
--- a/arch/alpha/include/uapi/asm/Kbuild
+++ b/arch/alpha/include/uapi/asm/Kbuild
@@ -2,4 +2,8 @@
2include include/uapi/asm-generic/Kbuild.asm 2include include/uapi/asm-generic/Kbuild.asm
3 3
4generic-y += bpf_perf_event.h 4generic-y += bpf_perf_event.h
5generic-y += ipcbuf.h
6generic-y += msgbuf.h
5generic-y += poll.h 7generic-y += poll.h
8generic-y += sembuf.h
9generic-y += shmbuf.h
diff --git a/arch/alpha/include/uapi/asm/ipcbuf.h b/arch/alpha/include/uapi/asm/ipcbuf.h
deleted file mode 100644
index 90d6445a14df..000000000000
--- a/arch/alpha/include/uapi/asm/ipcbuf.h
+++ /dev/null
@@ -1,2 +0,0 @@
1/* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */
2#include <asm-generic/ipcbuf.h>
diff --git a/arch/alpha/include/uapi/asm/msgbuf.h b/arch/alpha/include/uapi/asm/msgbuf.h
deleted file mode 100644
index 8c5d4d8c1b16..000000000000
--- a/arch/alpha/include/uapi/asm/msgbuf.h
+++ /dev/null
@@ -1,28 +0,0 @@
1/* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */
2#ifndef _ALPHA_MSGBUF_H
3#define _ALPHA_MSGBUF_H
4
5/*
6 * The msqid64_ds structure for alpha architecture.
7 * Note extra padding because this structure is passed back and forth
8 * between kernel and user space.
9 *
10 * Pad space is left for:
11 * - 2 miscellaneous 64-bit values
12 */
13
14struct msqid64_ds {
15 struct ipc64_perm msg_perm;
16 __kernel_time_t msg_stime; /* last msgsnd time */
17 __kernel_time_t msg_rtime; /* last msgrcv time */
18 __kernel_time_t msg_ctime; /* last change time */
19 unsigned long msg_cbytes; /* current number of bytes on queue */
20 unsigned long msg_qnum; /* number of messages in queue */
21 unsigned long msg_qbytes; /* max number of bytes on queue */
22 __kernel_pid_t msg_lspid; /* pid of last msgsnd */
23 __kernel_pid_t msg_lrpid; /* last receive pid */
24 unsigned long __unused1;
25 unsigned long __unused2;
26};
27
28#endif /* _ALPHA_MSGBUF_H */
diff --git a/arch/alpha/include/uapi/asm/sembuf.h b/arch/alpha/include/uapi/asm/sembuf.h
deleted file mode 100644
index f28ffa668b2f..000000000000
--- a/arch/alpha/include/uapi/asm/sembuf.h
+++ /dev/null
@@ -1,23 +0,0 @@
1/* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */
2#ifndef _ALPHA_SEMBUF_H
3#define _ALPHA_SEMBUF_H
4
5/*
6 * The semid64_ds structure for alpha architecture.
7 * Note extra padding because this structure is passed back and forth
8 * between kernel and user space.
9 *
10 * Pad space is left for:
11 * - 2 miscellaneous 64-bit values
12 */
13
14struct semid64_ds {
15 struct ipc64_perm sem_perm; /* permissions .. see ipc.h */
16 __kernel_time_t sem_otime; /* last semop time */
17 __kernel_time_t sem_ctime; /* last change time */
18 unsigned long sem_nsems; /* no. of semaphores in array */
19 unsigned long __unused1;
20 unsigned long __unused2;
21};
22
23#endif /* _ALPHA_SEMBUF_H */
diff --git a/arch/alpha/include/uapi/asm/shmbuf.h b/arch/alpha/include/uapi/asm/shmbuf.h
deleted file mode 100644
index 7e041ca2eb40..000000000000
--- a/arch/alpha/include/uapi/asm/shmbuf.h
+++ /dev/null
@@ -1,39 +0,0 @@
1/* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */
2#ifndef _ALPHA_SHMBUF_H
3#define _ALPHA_SHMBUF_H
4
5/*
6 * The shmid64_ds structure for alpha architecture.
7 * Note extra padding because this structure is passed back and forth
8 * between kernel and user space.
9 *
10 * Pad space is left for:
11 * - 2 miscellaneous 64-bit values
12 */
13
14struct shmid64_ds {
15 struct ipc64_perm shm_perm; /* operation perms */
16 size_t shm_segsz; /* size of segment (bytes) */
17 __kernel_time_t shm_atime; /* last attach time */
18 __kernel_time_t shm_dtime; /* last detach time */
19 __kernel_time_t shm_ctime; /* last change time */
20 __kernel_pid_t shm_cpid; /* pid of creator */
21 __kernel_pid_t shm_lpid; /* pid of last operator */
22 unsigned long shm_nattch; /* no. of current attaches */
23 unsigned long __unused1;
24 unsigned long __unused2;
25};
26
27struct shminfo64 {
28 unsigned long shmmax;
29 unsigned long shmmin;
30 unsigned long shmmni;
31 unsigned long shmseg;
32 unsigned long shmall;
33 unsigned long __unused1;
34 unsigned long __unused2;
35 unsigned long __unused3;
36 unsigned long __unused4;
37};
38
39#endif /* _ALPHA_SHMBUF_H */
diff --git a/arch/arm64/include/asm/compat.h b/arch/arm64/include/asm/compat.h
index 0030f79808b3..1a037b94eba1 100644
--- a/arch/arm64/include/asm/compat.h
+++ b/arch/arm64/include/asm/compat.h
@@ -181,10 +181,10 @@ struct compat_ipc64_perm {
181 181
182struct compat_semid64_ds { 182struct compat_semid64_ds {
183 struct compat_ipc64_perm sem_perm; 183 struct compat_ipc64_perm sem_perm;
184 compat_time_t sem_otime; 184 compat_ulong_t sem_otime;
185 compat_ulong_t __unused1; 185 compat_ulong_t sem_otime_high;
186 compat_time_t sem_ctime; 186 compat_ulong_t sem_ctime;
187 compat_ulong_t __unused2; 187 compat_ulong_t sem_ctime_high;
188 compat_ulong_t sem_nsems; 188 compat_ulong_t sem_nsems;
189 compat_ulong_t __unused3; 189 compat_ulong_t __unused3;
190 compat_ulong_t __unused4; 190 compat_ulong_t __unused4;
@@ -192,12 +192,12 @@ struct compat_semid64_ds {
192 192
193struct compat_msqid64_ds { 193struct compat_msqid64_ds {
194 struct compat_ipc64_perm msg_perm; 194 struct compat_ipc64_perm msg_perm;
195 compat_time_t msg_stime; 195 compat_ulong_t msg_stime;
196 compat_ulong_t __unused1; 196 compat_ulong_t msg_stime_high;
197 compat_time_t msg_rtime; 197 compat_ulong_t msg_rtime;
198 compat_ulong_t __unused2; 198 compat_ulong_t msg_rtime_high;
199 compat_time_t msg_ctime; 199 compat_ulong_t msg_ctime;
200 compat_ulong_t __unused3; 200 compat_ulong_t msg_ctime_high;
201 compat_ulong_t msg_cbytes; 201 compat_ulong_t msg_cbytes;
202 compat_ulong_t msg_qnum; 202 compat_ulong_t msg_qnum;
203 compat_ulong_t msg_qbytes; 203 compat_ulong_t msg_qbytes;
@@ -210,12 +210,12 @@ struct compat_msqid64_ds {
210struct compat_shmid64_ds { 210struct compat_shmid64_ds {
211 struct compat_ipc64_perm shm_perm; 211 struct compat_ipc64_perm shm_perm;
212 compat_size_t shm_segsz; 212 compat_size_t shm_segsz;
213 compat_time_t shm_atime; 213 compat_ulong_t shm_atime;
214 compat_ulong_t __unused1; 214 compat_ulong_t shm_atime_high;
215 compat_time_t shm_dtime; 215 compat_ulong_t shm_dtime;
216 compat_ulong_t __unused2; 216 compat_ulong_t shm_dtime_high;
217 compat_time_t shm_ctime; 217 compat_ulong_t shm_ctime;
218 compat_ulong_t __unused3; 218 compat_ulong_t shm_ctime_high;
219 compat_pid_t shm_cpid; 219 compat_pid_t shm_cpid;
220 compat_pid_t shm_lpid; 220 compat_pid_t shm_lpid;
221 compat_ulong_t shm_nattch; 221 compat_ulong_t shm_nattch;
diff --git a/arch/ia64/include/uapi/asm/Kbuild b/arch/ia64/include/uapi/asm/Kbuild
index c0527cfc48f0..3982e673e967 100644
--- a/arch/ia64/include/uapi/asm/Kbuild
+++ b/arch/ia64/include/uapi/asm/Kbuild
@@ -2,5 +2,9 @@
2include include/uapi/asm-generic/Kbuild.asm 2include include/uapi/asm-generic/Kbuild.asm
3 3
4generic-y += bpf_perf_event.h 4generic-y += bpf_perf_event.h
5generic-y += ipcbuf.h
5generic-y += kvm_para.h 6generic-y += kvm_para.h
7generic-y += msgbuf.h
6generic-y += poll.h 8generic-y += poll.h
9generic-y += sembuf.h
10generic-y += shmbuf.h
diff --git a/arch/ia64/include/uapi/asm/ipcbuf.h b/arch/ia64/include/uapi/asm/ipcbuf.h
deleted file mode 100644
index 90d6445a14df..000000000000
--- a/arch/ia64/include/uapi/asm/ipcbuf.h
+++ /dev/null
@@ -1,2 +0,0 @@
1/* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */
2#include <asm-generic/ipcbuf.h>
diff --git a/arch/ia64/include/uapi/asm/msgbuf.h b/arch/ia64/include/uapi/asm/msgbuf.h
deleted file mode 100644
index aa25df92d9dc..000000000000
--- a/arch/ia64/include/uapi/asm/msgbuf.h
+++ /dev/null
@@ -1,28 +0,0 @@
1/* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */
2#ifndef _ASM_IA64_MSGBUF_H
3#define _ASM_IA64_MSGBUF_H
4
5/*
6 * The msqid64_ds structure for IA-64 architecture.
7 * Note extra padding because this structure is passed back and forth
8 * between kernel and user space.
9 *
10 * Pad space is left for:
11 * - 2 miscellaneous 64-bit values
12 */
13
14struct msqid64_ds {
15 struct ipc64_perm msg_perm;
16 __kernel_time_t msg_stime; /* last msgsnd time */
17 __kernel_time_t msg_rtime; /* last msgrcv time */
18 __kernel_time_t msg_ctime; /* last change time */
19 unsigned long msg_cbytes; /* current number of bytes on queue */
20 unsigned long msg_qnum; /* number of messages in queue */
21 unsigned long msg_qbytes; /* max number of bytes on queue */
22 __kernel_pid_t msg_lspid; /* pid of last msgsnd */
23 __kernel_pid_t msg_lrpid; /* last receive pid */
24 unsigned long __unused1;
25 unsigned long __unused2;
26};
27
28#endif /* _ASM_IA64_MSGBUF_H */
diff --git a/arch/ia64/include/uapi/asm/sembuf.h b/arch/ia64/include/uapi/asm/sembuf.h
deleted file mode 100644
index 6ed058760afc..000000000000
--- a/arch/ia64/include/uapi/asm/sembuf.h
+++ /dev/null
@@ -1,23 +0,0 @@
1/* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */
2#ifndef _ASM_IA64_SEMBUF_H
3#define _ASM_IA64_SEMBUF_H
4
5/*
6 * The semid64_ds structure for IA-64 architecture.
7 * Note extra padding because this structure is passed back and forth
8 * between kernel and user space.
9 *
10 * Pad space is left for:
11 * - 2 miscellaneous 64-bit values
12 */
13
14struct semid64_ds {
15 struct ipc64_perm sem_perm; /* permissions .. see ipc.h */
16 __kernel_time_t sem_otime; /* last semop time */
17 __kernel_time_t sem_ctime; /* last change time */
18 unsigned long sem_nsems; /* no. of semaphores in array */
19 unsigned long __unused1;
20 unsigned long __unused2;
21};
22
23#endif /* _ASM_IA64_SEMBUF_H */
diff --git a/arch/ia64/include/uapi/asm/shmbuf.h b/arch/ia64/include/uapi/asm/shmbuf.h
deleted file mode 100644
index 6ef57cb70dee..000000000000
--- a/arch/ia64/include/uapi/asm/shmbuf.h
+++ /dev/null
@@ -1,39 +0,0 @@
1/* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */
2#ifndef _ASM_IA64_SHMBUF_H
3#define _ASM_IA64_SHMBUF_H
4
5/*
6 * The shmid64_ds structure for IA-64 architecture.
7 * Note extra padding because this structure is passed back and forth
8 * between kernel and user space.
9 *
10 * Pad space is left for:
11 * - 2 miscellaneous 64-bit values
12 */
13
14struct shmid64_ds {
15 struct ipc64_perm shm_perm; /* operation perms */
16 size_t shm_segsz; /* size of segment (bytes) */
17 __kernel_time_t shm_atime; /* last attach time */
18 __kernel_time_t shm_dtime; /* last detach time */
19 __kernel_time_t shm_ctime; /* last change time */
20 __kernel_pid_t shm_cpid; /* pid of creator */
21 __kernel_pid_t shm_lpid; /* pid of last operator */
22 unsigned long shm_nattch; /* no. of current attaches */
23 unsigned long __unused1;
24 unsigned long __unused2;
25};
26
27struct shminfo64 {
28 unsigned long shmmax;
29 unsigned long shmmin;
30 unsigned long shmmni;
31 unsigned long shmseg;
32 unsigned long shmall;
33 unsigned long __unused1;
34 unsigned long __unused2;
35 unsigned long __unused3;
36 unsigned long __unused4;
37};
38
39#endif /* _ASM_IA64_SHMBUF_H */
diff --git a/arch/mips/include/asm/compat.h b/arch/mips/include/asm/compat.h
index 3e548ee99a2f..78675f19440f 100644
--- a/arch/mips/include/asm/compat.h
+++ b/arch/mips/include/asm/compat.h
@@ -37,9 +37,11 @@ typedef struct {
37typedef s32 compat_timer_t; 37typedef s32 compat_timer_t;
38typedef s32 compat_key_t; 38typedef s32 compat_key_t;
39 39
40typedef s16 compat_short_t;
40typedef s32 compat_int_t; 41typedef s32 compat_int_t;
41typedef s32 compat_long_t; 42typedef s32 compat_long_t;
42typedef s64 compat_s64; 43typedef s64 compat_s64;
44typedef u16 compat_ushort_t;
43typedef u32 compat_uint_t; 45typedef u32 compat_uint_t;
44typedef u32 compat_ulong_t; 46typedef u32 compat_ulong_t;
45typedef u64 compat_u64; 47typedef u64 compat_u64;
@@ -157,35 +159,35 @@ struct compat_ipc64_perm {
157 159
158struct compat_semid64_ds { 160struct compat_semid64_ds {
159 struct compat_ipc64_perm sem_perm; 161 struct compat_ipc64_perm sem_perm;
160 compat_time_t sem_otime; 162 compat_ulong_t sem_otime;
161 compat_time_t sem_ctime; 163 compat_ulong_t sem_ctime;
162 compat_ulong_t sem_nsems; 164 compat_ulong_t sem_nsems;
163 compat_ulong_t __unused1; 165 compat_ulong_t sem_otime_high;
164 compat_ulong_t __unused2; 166 compat_ulong_t sem_ctime_high;
165}; 167};
166 168
167struct compat_msqid64_ds { 169struct compat_msqid64_ds {
168 struct compat_ipc64_perm msg_perm; 170 struct compat_ipc64_perm msg_perm;
169#ifndef CONFIG_CPU_LITTLE_ENDIAN 171#ifndef CONFIG_CPU_LITTLE_ENDIAN
170 compat_ulong_t __unused1; 172 compat_ulong_t msg_stime_high;
171#endif 173#endif
172 compat_time_t msg_stime; 174 compat_ulong_t msg_stime;
173#ifdef CONFIG_CPU_LITTLE_ENDIAN 175#ifdef CONFIG_CPU_LITTLE_ENDIAN
174 compat_ulong_t __unused1; 176 compat_ulong_t msg_stime_high;
175#endif 177#endif
176#ifndef CONFIG_CPU_LITTLE_ENDIAN 178#ifndef CONFIG_CPU_LITTLE_ENDIAN
177 compat_ulong_t __unused2; 179 compat_ulong_t msg_rtime_high;
178#endif 180#endif
179 compat_time_t msg_rtime; 181 compat_ulong_t msg_rtime;
180#ifdef CONFIG_CPU_LITTLE_ENDIAN 182#ifdef CONFIG_CPU_LITTLE_ENDIAN
181 compat_ulong_t __unused2; 183 compat_ulong_t msg_rtime_high;
182#endif 184#endif
183#ifndef CONFIG_CPU_LITTLE_ENDIAN 185#ifndef CONFIG_CPU_LITTLE_ENDIAN
184 compat_ulong_t __unused3; 186 compat_ulong_t msg_ctime_high;
185#endif 187#endif
186 compat_time_t msg_ctime; 188 compat_ulong_t msg_ctime;
187#ifdef CONFIG_CPU_LITTLE_ENDIAN 189#ifdef CONFIG_CPU_LITTLE_ENDIAN
188 compat_ulong_t __unused3; 190 compat_ulong_t msg_ctime_high;
189#endif 191#endif
190 compat_ulong_t msg_cbytes; 192 compat_ulong_t msg_cbytes;
191 compat_ulong_t msg_qnum; 193 compat_ulong_t msg_qnum;
@@ -199,14 +201,16 @@ struct compat_msqid64_ds {
199struct compat_shmid64_ds { 201struct compat_shmid64_ds {
200 struct compat_ipc64_perm shm_perm; 202 struct compat_ipc64_perm shm_perm;
201 compat_size_t shm_segsz; 203 compat_size_t shm_segsz;
202 compat_time_t shm_atime; 204 compat_ulong_t shm_atime;
203 compat_time_t shm_dtime; 205 compat_ulong_t shm_dtime;
204 compat_time_t shm_ctime; 206 compat_ulong_t shm_ctime;
205 compat_pid_t shm_cpid; 207 compat_pid_t shm_cpid;
206 compat_pid_t shm_lpid; 208 compat_pid_t shm_lpid;
207 compat_ulong_t shm_nattch; 209 compat_ulong_t shm_nattch;
208 compat_ulong_t __unused1; 210 compat_ushort_t shm_atime_high;
209 compat_ulong_t __unused2; 211 compat_ushort_t shm_dtime_high;
212 compat_ushort_t shm_ctime_high;
213 compat_ushort_t __unused2;
210}; 214};
211 215
212/* MIPS has unusual order of fields in stack_t */ 216/* MIPS has unusual order of fields in stack_t */
diff --git a/arch/mips/include/uapi/asm/msgbuf.h b/arch/mips/include/uapi/asm/msgbuf.h
index eb4d0f9d7364..46aa15b13e4e 100644
--- a/arch/mips/include/uapi/asm/msgbuf.h
+++ b/arch/mips/include/uapi/asm/msgbuf.h
@@ -9,33 +9,15 @@
9 * between kernel and user space. 9 * between kernel and user space.
10 * 10 *
11 * Pad space is left for: 11 * Pad space is left for:
12 * - extension of time_t to 64-bit on 32-bitsystem to solve the y2038 problem
13 * - 2 miscellaneous unsigned long values 12 * - 2 miscellaneous unsigned long values
14 */ 13 */
15 14
15#if defined(__mips64)
16struct msqid64_ds { 16struct msqid64_ds {
17 struct ipc64_perm msg_perm; 17 struct ipc64_perm msg_perm;
18#if !defined(__mips64) && defined(__MIPSEB__)
19 unsigned long __unused1;
20#endif
21 __kernel_time_t msg_stime; /* last msgsnd time */ 18 __kernel_time_t msg_stime; /* last msgsnd time */
22#if !defined(__mips64) && defined(__MIPSEL__)
23 unsigned long __unused1;
24#endif
25#if !defined(__mips64) && defined(__MIPSEB__)
26 unsigned long __unused2;
27#endif
28 __kernel_time_t msg_rtime; /* last msgrcv time */ 19 __kernel_time_t msg_rtime; /* last msgrcv time */
29#if !defined(__mips64) && defined(__MIPSEL__)
30 unsigned long __unused2;
31#endif
32#if !defined(__mips64) && defined(__MIPSEB__)
33 unsigned long __unused3;
34#endif
35 __kernel_time_t msg_ctime; /* last change time */ 20 __kernel_time_t msg_ctime; /* last change time */
36#if !defined(__mips64) && defined(__MIPSEL__)
37 unsigned long __unused3;
38#endif
39 unsigned long msg_cbytes; /* current number of bytes on queue */ 21 unsigned long msg_cbytes; /* current number of bytes on queue */
40 unsigned long msg_qnum; /* number of messages in queue */ 22 unsigned long msg_qnum; /* number of messages in queue */
41 unsigned long msg_qbytes; /* max number of bytes on queue */ 23 unsigned long msg_qbytes; /* max number of bytes on queue */
@@ -44,5 +26,42 @@ struct msqid64_ds {
44 unsigned long __unused4; 26 unsigned long __unused4;
45 unsigned long __unused5; 27 unsigned long __unused5;
46}; 28};
29#elif defined (__MIPSEB__)
30struct msqid64_ds {
31 struct ipc64_perm msg_perm;
32 unsigned long msg_stime_high;
33 unsigned long msg_stime; /* last msgsnd time */
34 unsigned long msg_rtime_high;
35 unsigned long msg_rtime; /* last msgrcv time */
36 unsigned long msg_ctime_high;
37 unsigned long msg_ctime; /* last change time */
38 unsigned long msg_cbytes; /* current number of bytes on queue */
39 unsigned long msg_qnum; /* number of messages in queue */
40 unsigned long msg_qbytes; /* max number of bytes on queue */
41 __kernel_pid_t msg_lspid; /* pid of last msgsnd */
42 __kernel_pid_t msg_lrpid; /* last receive pid */
43 unsigned long __unused4;
44 unsigned long __unused5;
45};
46#elif defined (__MIPSEL__)
47struct msqid64_ds {
48 struct ipc64_perm msg_perm;
49 unsigned long msg_stime; /* last msgsnd time */
50 unsigned long msg_stime_high;
51 unsigned long msg_rtime; /* last msgrcv time */
52 unsigned long msg_rtime_high;
53 unsigned long msg_ctime; /* last change time */
54 unsigned long msg_ctime_high;
55 unsigned long msg_cbytes; /* current number of bytes on queue */
56 unsigned long msg_qnum; /* number of messages in queue */
57 unsigned long msg_qbytes; /* max number of bytes on queue */
58 __kernel_pid_t msg_lspid; /* pid of last msgsnd */
59 __kernel_pid_t msg_lrpid; /* last receive pid */
60 unsigned long __unused4;
61 unsigned long __unused5;
62};
63#else
64#warning no endianess set
65#endif
47 66
48#endif /* _ASM_MSGBUF_H */ 67#endif /* _ASM_MSGBUF_H */
diff --git a/arch/mips/include/uapi/asm/sembuf.h b/arch/mips/include/uapi/asm/sembuf.h
index 2c0f507ab7d1..60c89e6cb25b 100644
--- a/arch/mips/include/uapi/asm/sembuf.h
+++ b/arch/mips/include/uapi/asm/sembuf.h
@@ -7,10 +7,11 @@
7 * Note extra padding because this structure is passed back and forth 7 * Note extra padding because this structure is passed back and forth
8 * between kernel and user space. 8 * between kernel and user space.
9 * 9 *
10 * Pad space is left for: 10 * Pad space is left for 2 miscellaneous 64-bit values on mips64,
11 * - 2 miscellaneous 64-bit values 11 * but used for the upper 32 bit of the time values on mips32.
12 */ 12 */
13 13
14#ifdef __mips64
14struct semid64_ds { 15struct semid64_ds {
15 struct ipc64_perm sem_perm; /* permissions .. see ipc.h */ 16 struct ipc64_perm sem_perm; /* permissions .. see ipc.h */
16 __kernel_time_t sem_otime; /* last semop time */ 17 __kernel_time_t sem_otime; /* last semop time */
@@ -19,5 +20,15 @@ struct semid64_ds {
19 unsigned long __unused1; 20 unsigned long __unused1;
20 unsigned long __unused2; 21 unsigned long __unused2;
21}; 22};
23#else
24struct semid64_ds {
25 struct ipc64_perm sem_perm; /* permissions .. see ipc.h */
26 unsigned long sem_otime; /* last semop time */
27 unsigned long sem_ctime; /* last change time */
28 unsigned long sem_nsems; /* no. of semaphores in array */
29 unsigned long sem_otime_high;
30 unsigned long sem_ctime_high;
31};
32#endif
22 33
23#endif /* _ASM_SEMBUF_H */ 34#endif /* _ASM_SEMBUF_H */
diff --git a/arch/mips/include/uapi/asm/shmbuf.h b/arch/mips/include/uapi/asm/shmbuf.h
index 379e6bca518b..9b9bba3401f2 100644
--- a/arch/mips/include/uapi/asm/shmbuf.h
+++ b/arch/mips/include/uapi/asm/shmbuf.h
@@ -7,10 +7,13 @@
7 * Note extra padding because this structure is passed back and forth 7 * Note extra padding because this structure is passed back and forth
8 * between kernel and user space. 8 * between kernel and user space.
9 * 9 *
10 * Pad space is left for: 10 * As MIPS was lacking proper padding after shm_?time, we use 48 bits
11 * - 2 miscellaneous 32-bit rsp. 64-bit values 11 * of the padding at the end to store a few additional bits of the time.
12 * libc implementations need to take care to convert this into a proper
13 * data structure when moving to 64-bit time_t.
12 */ 14 */
13 15
16#ifdef __mips64
14struct shmid64_ds { 17struct shmid64_ds {
15 struct ipc64_perm shm_perm; /* operation perms */ 18 struct ipc64_perm shm_perm; /* operation perms */
16 size_t shm_segsz; /* size of segment (bytes) */ 19 size_t shm_segsz; /* size of segment (bytes) */
@@ -23,6 +26,22 @@ struct shmid64_ds {
23 unsigned long __unused1; 26 unsigned long __unused1;
24 unsigned long __unused2; 27 unsigned long __unused2;
25}; 28};
29#else
30struct shmid64_ds {
31 struct ipc64_perm shm_perm; /* operation perms */
32 size_t shm_segsz; /* size of segment (bytes) */
33 unsigned long shm_atime; /* last attach time */
34 unsigned long shm_dtime; /* last detach time */
35 unsigned long shm_ctime; /* last change time */
36 __kernel_pid_t shm_cpid; /* pid of creator */
37 __kernel_pid_t shm_lpid; /* pid of last operator */
38 unsigned long shm_nattch; /* no. of current attaches */
39 unsigned short shm_atime_high;
40 unsigned short shm_dtime_high;
41 unsigned short shm_ctime_high;
42 unsigned short __unused1;
43};
44#endif
26 45
27struct shminfo64 { 46struct shminfo64 {
28 unsigned long shmmax; 47 unsigned long shmmax;
diff --git a/arch/parisc/include/asm/compat.h b/arch/parisc/include/asm/compat.h
index 0cdfec8857bd..ab8a54771507 100644
--- a/arch/parisc/include/asm/compat.h
+++ b/arch/parisc/include/asm/compat.h
@@ -138,10 +138,10 @@ struct compat_ipc64_perm {
138 138
139struct compat_semid64_ds { 139struct compat_semid64_ds {
140 struct compat_ipc64_perm sem_perm; 140 struct compat_ipc64_perm sem_perm;
141 unsigned int __unused1; 141 unsigned int sem_otime_high;
142 compat_time_t sem_otime; 142 unsigned int sem_otime;
143 unsigned int __unused2; 143 unsigned int sem_ctime_high;
144 compat_time_t sem_ctime; 144 unsigned int sem_ctime;
145 compat_ulong_t sem_nsems; 145 compat_ulong_t sem_nsems;
146 compat_ulong_t __unused3; 146 compat_ulong_t __unused3;
147 compat_ulong_t __unused4; 147 compat_ulong_t __unused4;
@@ -149,12 +149,12 @@ struct compat_semid64_ds {
149 149
150struct compat_msqid64_ds { 150struct compat_msqid64_ds {
151 struct compat_ipc64_perm msg_perm; 151 struct compat_ipc64_perm msg_perm;
152 unsigned int __unused1; 152 unsigned int msg_stime_high;
153 compat_time_t msg_stime; 153 unsigned int msg_stime;
154 unsigned int __unused2; 154 unsigned int msg_rtime_high;
155 compat_time_t msg_rtime; 155 unsigned int msg_rtime;
156 unsigned int __unused3; 156 unsigned int msg_ctime_high;
157 compat_time_t msg_ctime; 157 unsigned int msg_ctime;
158 compat_ulong_t msg_cbytes; 158 compat_ulong_t msg_cbytes;
159 compat_ulong_t msg_qnum; 159 compat_ulong_t msg_qnum;
160 compat_ulong_t msg_qbytes; 160 compat_ulong_t msg_qbytes;
@@ -166,12 +166,12 @@ struct compat_msqid64_ds {
166 166
167struct compat_shmid64_ds { 167struct compat_shmid64_ds {
168 struct compat_ipc64_perm shm_perm; 168 struct compat_ipc64_perm shm_perm;
169 unsigned int __unused1; 169 unsigned int shm_atime_high;
170 compat_time_t shm_atime; 170 unsigned int shm_atime;
171 unsigned int __unused2; 171 unsigned int shm_dtime_high;
172 compat_time_t shm_dtime; 172 unsigned int shm_dtime;
173 unsigned int __unused3; 173 unsigned int shm_ctime_high;
174 compat_time_t shm_ctime; 174 unsigned int shm_ctime;
175 unsigned int __unused4; 175 unsigned int __unused4;
176 compat_size_t shm_segsz; 176 compat_size_t shm_segsz;
177 compat_pid_t shm_cpid; 177 compat_pid_t shm_cpid;
diff --git a/arch/parisc/include/uapi/asm/msgbuf.h b/arch/parisc/include/uapi/asm/msgbuf.h
index b48b810e626b..6a2e9ab2ef8d 100644
--- a/arch/parisc/include/uapi/asm/msgbuf.h
+++ b/arch/parisc/include/uapi/asm/msgbuf.h
@@ -10,31 +10,30 @@
10 * between kernel and user space. 10 * between kernel and user space.
11 * 11 *
12 * Pad space is left for: 12 * Pad space is left for:
13 * - 64-bit time_t to solve y2038 problem
14 * - 2 miscellaneous 32-bit values 13 * - 2 miscellaneous 32-bit values
15 */ 14 */
16 15
17struct msqid64_ds { 16struct msqid64_ds {
18 struct ipc64_perm msg_perm; 17 struct ipc64_perm msg_perm;
19#if __BITS_PER_LONG != 64 18#if __BITS_PER_LONG == 64
20 unsigned int __pad1;
21#endif
22 __kernel_time_t msg_stime; /* last msgsnd time */ 19 __kernel_time_t msg_stime; /* last msgsnd time */
23#if __BITS_PER_LONG != 64
24 unsigned int __pad2;
25#endif
26 __kernel_time_t msg_rtime; /* last msgrcv time */ 20 __kernel_time_t msg_rtime; /* last msgrcv time */
27#if __BITS_PER_LONG != 64
28 unsigned int __pad3;
29#endif
30 __kernel_time_t msg_ctime; /* last change time */ 21 __kernel_time_t msg_ctime; /* last change time */
31 unsigned long msg_cbytes; /* current number of bytes on queue */ 22#else
32 unsigned long msg_qnum; /* number of messages in queue */ 23 unsigned long msg_stime_high;
33 unsigned long msg_qbytes; /* max number of bytes on queue */ 24 unsigned long msg_stime; /* last msgsnd time */
34 __kernel_pid_t msg_lspid; /* pid of last msgsnd */ 25 unsigned long msg_rtime_high;
35 __kernel_pid_t msg_lrpid; /* last receive pid */ 26 unsigned long msg_rtime; /* last msgrcv time */
36 unsigned long __unused1; 27 unsigned long msg_ctime_high;
37 unsigned long __unused2; 28 unsigned long msg_ctime; /* last change time */
29#endif
30 unsigned long msg_cbytes; /* current number of bytes on queue */
31 unsigned long msg_qnum; /* number of messages in queue */
32 unsigned long msg_qbytes; /* max number of bytes on queue */
33 __kernel_pid_t msg_lspid; /* pid of last msgsnd */
34 __kernel_pid_t msg_lrpid; /* last receive pid */
35 unsigned long __unused1;
36 unsigned long __unused2;
38}; 37};
39 38
40#endif /* _PARISC_MSGBUF_H */ 39#endif /* _PARISC_MSGBUF_H */
diff --git a/arch/parisc/include/uapi/asm/sembuf.h b/arch/parisc/include/uapi/asm/sembuf.h
index 746c5d86a9b1..3c31163b1241 100644
--- a/arch/parisc/include/uapi/asm/sembuf.h
+++ b/arch/parisc/include/uapi/asm/sembuf.h
@@ -10,21 +10,21 @@
10 * between kernel and user space. 10 * between kernel and user space.
11 * 11 *
12 * Pad space is left for: 12 * Pad space is left for:
13 * - 64-bit time_t to solve y2038 problem
14 * - 2 miscellaneous 32-bit values 13 * - 2 miscellaneous 32-bit values
15 */ 14 */
16 15
17struct semid64_ds { 16struct semid64_ds {
18 struct ipc64_perm sem_perm; /* permissions .. see ipc.h */ 17 struct ipc64_perm sem_perm; /* permissions .. see ipc.h */
19#if __BITS_PER_LONG != 64 18#if __BITS_PER_LONG == 64
20 unsigned int __pad1;
21#endif
22 __kernel_time_t sem_otime; /* last semop time */ 19 __kernel_time_t sem_otime; /* last semop time */
23#if __BITS_PER_LONG != 64
24 unsigned int __pad2;
25#endif
26 __kernel_time_t sem_ctime; /* last change time */ 20 __kernel_time_t sem_ctime; /* last change time */
27 unsigned long sem_nsems; /* no. of semaphores in array */ 21#else
22 unsigned long sem_otime_high;
23 unsigned long sem_otime; /* last semop time */
24 unsigned long sem_ctime_high;
25 unsigned long sem_ctime; /* last change time */
26#endif
27 unsigned long sem_nsems; /* no. of semaphores in array */
28 unsigned long __unused1; 28 unsigned long __unused1;
29 unsigned long __unused2; 29 unsigned long __unused2;
30}; 30};
diff --git a/arch/parisc/include/uapi/asm/shmbuf.h b/arch/parisc/include/uapi/asm/shmbuf.h
index cd4dbce55d0b..c89b3dd8db21 100644
--- a/arch/parisc/include/uapi/asm/shmbuf.h
+++ b/arch/parisc/include/uapi/asm/shmbuf.h
@@ -10,25 +10,22 @@
10 * between kernel and user space. 10 * between kernel and user space.
11 * 11 *
12 * Pad space is left for: 12 * Pad space is left for:
13 * - 64-bit time_t to solve y2038 problem
14 * - 2 miscellaneous 32-bit values 13 * - 2 miscellaneous 32-bit values
15 */ 14 */
16 15
17struct shmid64_ds { 16struct shmid64_ds {
18 struct ipc64_perm shm_perm; /* operation perms */ 17 struct ipc64_perm shm_perm; /* operation perms */
19#if __BITS_PER_LONG != 64 18#if __BITS_PER_LONG == 64
20 unsigned int __pad1;
21#endif
22 __kernel_time_t shm_atime; /* last attach time */ 19 __kernel_time_t shm_atime; /* last attach time */
23#if __BITS_PER_LONG != 64
24 unsigned int __pad2;
25#endif
26 __kernel_time_t shm_dtime; /* last detach time */ 20 __kernel_time_t shm_dtime; /* last detach time */
27#if __BITS_PER_LONG != 64
28 unsigned int __pad3;
29#endif
30 __kernel_time_t shm_ctime; /* last change time */ 21 __kernel_time_t shm_ctime; /* last change time */
31#if __BITS_PER_LONG != 64 22#else
23 unsigned long shm_atime_high;
24 unsigned long shm_atime; /* last attach time */
25 unsigned long shm_dtime_high;
26 unsigned long shm_dtime; /* last detach time */
27 unsigned long shm_ctime_high;
28 unsigned long shm_ctime; /* last change time */
32 unsigned int __pad4; 29 unsigned int __pad4;
33#endif 30#endif
34 __kernel_size_t shm_segsz; /* size of segment (bytes) */ 31 __kernel_size_t shm_segsz; /* size of segment (bytes) */
diff --git a/arch/powerpc/include/asm/compat.h b/arch/powerpc/include/asm/compat.h
index b4773c81f7d5..85c8af2bb272 100644
--- a/arch/powerpc/include/asm/compat.h
+++ b/arch/powerpc/include/asm/compat.h
@@ -162,10 +162,10 @@ struct compat_ipc64_perm {
162 162
163struct compat_semid64_ds { 163struct compat_semid64_ds {
164 struct compat_ipc64_perm sem_perm; 164 struct compat_ipc64_perm sem_perm;
165 unsigned int __unused1; 165 unsigned int sem_otime_high;
166 compat_time_t sem_otime; 166 unsigned int sem_otime;
167 unsigned int __unused2; 167 unsigned int sem_ctime_high;
168 compat_time_t sem_ctime; 168 unsigned int sem_ctime;
169 compat_ulong_t sem_nsems; 169 compat_ulong_t sem_nsems;
170 compat_ulong_t __unused3; 170 compat_ulong_t __unused3;
171 compat_ulong_t __unused4; 171 compat_ulong_t __unused4;
@@ -173,12 +173,12 @@ struct compat_semid64_ds {
173 173
174struct compat_msqid64_ds { 174struct compat_msqid64_ds {
175 struct compat_ipc64_perm msg_perm; 175 struct compat_ipc64_perm msg_perm;
176 unsigned int __unused1; 176 unsigned int msg_stime_high;
177 compat_time_t msg_stime; 177 unsigned int msg_stime;
178 unsigned int __unused2; 178 unsigned int msg_rtime_high;
179 compat_time_t msg_rtime; 179 unsigned int msg_rtime;
180 unsigned int __unused3; 180 unsigned int msg_ctime_high;
181 compat_time_t msg_ctime; 181 unsigned int msg_ctime;
182 compat_ulong_t msg_cbytes; 182 compat_ulong_t msg_cbytes;
183 compat_ulong_t msg_qnum; 183 compat_ulong_t msg_qnum;
184 compat_ulong_t msg_qbytes; 184 compat_ulong_t msg_qbytes;
@@ -190,12 +190,12 @@ struct compat_msqid64_ds {
190 190
191struct compat_shmid64_ds { 191struct compat_shmid64_ds {
192 struct compat_ipc64_perm shm_perm; 192 struct compat_ipc64_perm shm_perm;
193 unsigned int __unused1; 193 unsigned int shm_atime_high;
194 compat_time_t shm_atime; 194 unsigned int shm_atime;
195 unsigned int __unused2; 195 unsigned int shm_dtime_high;
196 compat_time_t shm_dtime; 196 unsigned int shm_dtime;
197 unsigned int __unused3; 197 unsigned int shm_ctime_high;
198 compat_time_t shm_ctime; 198 unsigned int shm_ctime;
199 unsigned int __unused4; 199 unsigned int __unused4;
200 compat_size_t shm_segsz; 200 compat_size_t shm_segsz;
201 compat_pid_t shm_cpid; 201 compat_pid_t shm_cpid;
diff --git a/arch/powerpc/include/uapi/asm/msgbuf.h b/arch/powerpc/include/uapi/asm/msgbuf.h
index 65beb0942500..2b1b37797a47 100644
--- a/arch/powerpc/include/uapi/asm/msgbuf.h
+++ b/arch/powerpc/include/uapi/asm/msgbuf.h
@@ -10,18 +10,18 @@
10 10
11struct msqid64_ds { 11struct msqid64_ds {
12 struct ipc64_perm msg_perm; 12 struct ipc64_perm msg_perm;
13#ifndef __powerpc64__ 13#ifdef __powerpc64__
14 unsigned int __unused1;
15#endif
16 __kernel_time_t msg_stime; /* last msgsnd time */ 14 __kernel_time_t msg_stime; /* last msgsnd time */
17#ifndef __powerpc64__
18 unsigned int __unused2;
19#endif
20 __kernel_time_t msg_rtime; /* last msgrcv time */ 15 __kernel_time_t msg_rtime; /* last msgrcv time */
21#ifndef __powerpc64__
22 unsigned int __unused3;
23#endif
24 __kernel_time_t msg_ctime; /* last change time */ 16 __kernel_time_t msg_ctime; /* last change time */
17#else
18 unsigned long msg_stime_high;
19 unsigned long msg_stime; /* last msgsnd time */
20 unsigned long msg_rtime_high;
21 unsigned long msg_rtime; /* last msgrcv time */
22 unsigned long msg_ctime_high;
23 unsigned long msg_ctime; /* last change time */
24#endif
25 unsigned long msg_cbytes; /* current number of bytes on queue */ 25 unsigned long msg_cbytes; /* current number of bytes on queue */
26 unsigned long msg_qnum; /* number of messages in queue */ 26 unsigned long msg_qnum; /* number of messages in queue */
27 unsigned long msg_qbytes; /* max number of bytes on queue */ 27 unsigned long msg_qbytes; /* max number of bytes on queue */
diff --git a/arch/powerpc/include/uapi/asm/sembuf.h b/arch/powerpc/include/uapi/asm/sembuf.h
index 8f393d60f02d..3f60946f77e3 100644
--- a/arch/powerpc/include/uapi/asm/sembuf.h
+++ b/arch/powerpc/include/uapi/asm/sembuf.h
@@ -15,20 +15,20 @@
15 * between kernel and user space. 15 * between kernel and user space.
16 * 16 *
17 * Pad space is left for: 17 * Pad space is left for:
18 * - 64-bit time_t to solve y2038 problem 18 * - 2 miscellaneous 32/64-bit values
19 * - 2 miscellaneous 32-bit values
20 */ 19 */
21 20
22struct semid64_ds { 21struct semid64_ds {
23 struct ipc64_perm sem_perm; /* permissions .. see ipc.h */ 22 struct ipc64_perm sem_perm; /* permissions .. see ipc.h */
24#ifndef __powerpc64__ 23#ifndef __powerpc64__
25 unsigned long __unused1; 24 unsigned long sem_otime_high;
26#endif 25 unsigned long sem_otime; /* last semop time */
26 unsigned long sem_ctime_high;
27 unsigned long sem_ctime; /* last change time */
28#else
27 __kernel_time_t sem_otime; /* last semop time */ 29 __kernel_time_t sem_otime; /* last semop time */
28#ifndef __powerpc64__
29 unsigned long __unused2;
30#endif
31 __kernel_time_t sem_ctime; /* last change time */ 30 __kernel_time_t sem_ctime; /* last change time */
31#endif
32 unsigned long sem_nsems; /* no. of semaphores in array */ 32 unsigned long sem_nsems; /* no. of semaphores in array */
33 unsigned long __unused3; 33 unsigned long __unused3;
34 unsigned long __unused4; 34 unsigned long __unused4;
diff --git a/arch/powerpc/include/uapi/asm/shmbuf.h b/arch/powerpc/include/uapi/asm/shmbuf.h
index deb1c3e503d3..b591c4d7e4c5 100644
--- a/arch/powerpc/include/uapi/asm/shmbuf.h
+++ b/arch/powerpc/include/uapi/asm/shmbuf.h
@@ -16,25 +16,22 @@
16 * between kernel and user space. 16 * between kernel and user space.
17 * 17 *
18 * Pad space is left for: 18 * Pad space is left for:
19 * - 64-bit time_t to solve y2038 problem
20 * - 2 miscellaneous 32-bit values 19 * - 2 miscellaneous 32-bit values
21 */ 20 */
22 21
23struct shmid64_ds { 22struct shmid64_ds {
24 struct ipc64_perm shm_perm; /* operation perms */ 23 struct ipc64_perm shm_perm; /* operation perms */
25#ifndef __powerpc64__ 24#ifdef __powerpc64__
26 unsigned long __unused1;
27#endif
28 __kernel_time_t shm_atime; /* last attach time */ 25 __kernel_time_t shm_atime; /* last attach time */
29#ifndef __powerpc64__
30 unsigned long __unused2;
31#endif
32 __kernel_time_t shm_dtime; /* last detach time */ 26 __kernel_time_t shm_dtime; /* last detach time */
33#ifndef __powerpc64__
34 unsigned long __unused3;
35#endif
36 __kernel_time_t shm_ctime; /* last change time */ 27 __kernel_time_t shm_ctime; /* last change time */
37#ifndef __powerpc64__ 28#else
29 unsigned long shm_atime_high;
30 unsigned long shm_atime; /* last attach time */
31 unsigned long shm_dtime_high;
32 unsigned long shm_dtime; /* last detach time */
33 unsigned long shm_ctime_high;
34 unsigned long shm_ctime; /* last change time */
38 unsigned long __unused4; 35 unsigned long __unused4;
39#endif 36#endif
40 size_t shm_segsz; /* size of segment (bytes) */ 37 size_t shm_segsz; /* size of segment (bytes) */
diff --git a/arch/s390/include/asm/compat.h b/arch/s390/include/asm/compat.h
index 501aaff85304..97db2fba546a 100644
--- a/arch/s390/include/asm/compat.h
+++ b/arch/s390/include/asm/compat.h
@@ -232,10 +232,10 @@ struct compat_ipc64_perm {
232 232
233struct compat_semid64_ds { 233struct compat_semid64_ds {
234 struct compat_ipc64_perm sem_perm; 234 struct compat_ipc64_perm sem_perm;
235 compat_time_t sem_otime; 235 compat_ulong_t sem_otime;
236 compat_ulong_t __pad1; 236 compat_ulong_t sem_otime_high;
237 compat_time_t sem_ctime; 237 compat_ulong_t sem_ctime;
238 compat_ulong_t __pad2; 238 compat_ulong_t sem_ctime_high;
239 compat_ulong_t sem_nsems; 239 compat_ulong_t sem_nsems;
240 compat_ulong_t __unused1; 240 compat_ulong_t __unused1;
241 compat_ulong_t __unused2; 241 compat_ulong_t __unused2;
@@ -243,12 +243,12 @@ struct compat_semid64_ds {
243 243
244struct compat_msqid64_ds { 244struct compat_msqid64_ds {
245 struct compat_ipc64_perm msg_perm; 245 struct compat_ipc64_perm msg_perm;
246 compat_time_t msg_stime; 246 compat_ulong_t msg_stime;
247 compat_ulong_t __pad1; 247 compat_ulong_t msg_stime_high;
248 compat_time_t msg_rtime; 248 compat_ulong_t msg_rtime;
249 compat_ulong_t __pad2; 249 compat_ulong_t msg_rtime_high;
250 compat_time_t msg_ctime; 250 compat_ulong_t msg_ctime;
251 compat_ulong_t __pad3; 251 compat_ulong_t msg_ctime_high;
252 compat_ulong_t msg_cbytes; 252 compat_ulong_t msg_cbytes;
253 compat_ulong_t msg_qnum; 253 compat_ulong_t msg_qnum;
254 compat_ulong_t msg_qbytes; 254 compat_ulong_t msg_qbytes;
@@ -261,12 +261,12 @@ struct compat_msqid64_ds {
261struct compat_shmid64_ds { 261struct compat_shmid64_ds {
262 struct compat_ipc64_perm shm_perm; 262 struct compat_ipc64_perm shm_perm;
263 compat_size_t shm_segsz; 263 compat_size_t shm_segsz;
264 compat_time_t shm_atime; 264 compat_ulong_t shm_atime;
265 compat_ulong_t __pad1; 265 compat_ulong_t shm_atime_high;
266 compat_time_t shm_dtime; 266 compat_ulong_t shm_dtime;
267 compat_ulong_t __pad2; 267 compat_ulong_t shm_dtime_high;
268 compat_time_t shm_ctime; 268 compat_ulong_t shm_ctime;
269 compat_ulong_t __pad3; 269 compat_ulong_t shm_ctime_high;
270 compat_pid_t shm_cpid; 270 compat_pid_t shm_cpid;
271 compat_pid_t shm_lpid; 271 compat_pid_t shm_lpid;
272 compat_ulong_t shm_nattch; 272 compat_ulong_t shm_nattch;
diff --git a/arch/s390/include/uapi/asm/Kbuild b/arch/s390/include/uapi/asm/Kbuild
index faef3f7e8353..e364873e0d10 100644
--- a/arch/s390/include/uapi/asm/Kbuild
+++ b/arch/s390/include/uapi/asm/Kbuild
@@ -9,9 +9,12 @@ generic-y += errno.h
9generic-y += fcntl.h 9generic-y += fcntl.h
10generic-y += ioctl.h 10generic-y += ioctl.h
11generic-y += mman.h 11generic-y += mman.h
12generic-y += msgbuf.h
12generic-y += param.h 13generic-y += param.h
13generic-y += poll.h 14generic-y += poll.h
14generic-y += resource.h 15generic-y += resource.h
16generic-y += sembuf.h
17generic-y += shmbuf.h
15generic-y += sockios.h 18generic-y += sockios.h
16generic-y += swab.h 19generic-y += swab.h
17generic-y += termbits.h 20generic-y += termbits.h
diff --git a/arch/s390/include/uapi/asm/msgbuf.h b/arch/s390/include/uapi/asm/msgbuf.h
deleted file mode 100644
index 604f847cd68c..000000000000
--- a/arch/s390/include/uapi/asm/msgbuf.h
+++ /dev/null
@@ -1,38 +0,0 @@
1/* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */
2#ifndef _S390_MSGBUF_H
3#define _S390_MSGBUF_H
4
5/*
6 * The msqid64_ds structure for S/390 architecture.
7 * Note extra padding because this structure is passed back and forth
8 * between kernel and user space.
9 *
10 * Pad space is left for:
11 * - 64-bit time_t to solve y2038 problem
12 * - 2 miscellaneous 32-bit values
13 */
14
15struct msqid64_ds {
16 struct ipc64_perm msg_perm;
17 __kernel_time_t msg_stime; /* last msgsnd time */
18#ifndef __s390x__
19 unsigned long __unused1;
20#endif /* ! __s390x__ */
21 __kernel_time_t msg_rtime; /* last msgrcv time */
22#ifndef __s390x__
23 unsigned long __unused2;
24#endif /* ! __s390x__ */
25 __kernel_time_t msg_ctime; /* last change time */
26#ifndef __s390x__
27 unsigned long __unused3;
28#endif /* ! __s390x__ */
29 unsigned long msg_cbytes; /* current number of bytes on queue */
30 unsigned long msg_qnum; /* number of messages in queue */
31 unsigned long msg_qbytes; /* max number of bytes on queue */
32 __kernel_pid_t msg_lspid; /* pid of last msgsnd */
33 __kernel_pid_t msg_lrpid; /* last receive pid */
34 unsigned long __unused4;
35 unsigned long __unused5;
36};
37
38#endif /* _S390_MSGBUF_H */
diff --git a/arch/s390/include/uapi/asm/sembuf.h b/arch/s390/include/uapi/asm/sembuf.h
deleted file mode 100644
index 3e917697b668..000000000000
--- a/arch/s390/include/uapi/asm/sembuf.h
+++ /dev/null
@@ -1,30 +0,0 @@
1/* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */
2#ifndef _S390_SEMBUF_H
3#define _S390_SEMBUF_H
4
5/*
6 * The semid64_ds structure for S/390 architecture.
7 * Note extra padding because this structure is passed back and forth
8 * between kernel and user space.
9 *
10 * Pad space is left for:
11 * - 64-bit time_t to solve y2038 problem (for !__s390x__)
12 * - 2 miscellaneous 32-bit values
13 */
14
15struct semid64_ds {
16 struct ipc64_perm sem_perm; /* permissions .. see ipc.h */
17 __kernel_time_t sem_otime; /* last semop time */
18#ifndef __s390x__
19 unsigned long __unused1;
20#endif /* ! __s390x__ */
21 __kernel_time_t sem_ctime; /* last change time */
22#ifndef __s390x__
23 unsigned long __unused2;
24#endif /* ! __s390x__ */
25 unsigned long sem_nsems; /* no. of semaphores in array */
26 unsigned long __unused3;
27 unsigned long __unused4;
28};
29
30#endif /* _S390_SEMBUF_H */
diff --git a/arch/s390/include/uapi/asm/shmbuf.h b/arch/s390/include/uapi/asm/shmbuf.h
deleted file mode 100644
index 9cdce8d7ce60..000000000000
--- a/arch/s390/include/uapi/asm/shmbuf.h
+++ /dev/null
@@ -1,49 +0,0 @@
1/* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */
2#ifndef _S390_SHMBUF_H
3#define _S390_SHMBUF_H
4
5/*
6 * The shmid64_ds structure for S/390 architecture.
7 * Note extra padding because this structure is passed back and forth
8 * between kernel and user space.
9 *
10 * Pad space is left for:
11 * - 64-bit time_t to solve y2038 problem (for !__s390x__)
12 * - 2 miscellaneous 32-bit values
13 */
14
15struct shmid64_ds {
16 struct ipc64_perm shm_perm; /* operation perms */
17 size_t shm_segsz; /* size of segment (bytes) */
18 __kernel_time_t shm_atime; /* last attach time */
19#ifndef __s390x__
20 unsigned long __unused1;
21#endif /* ! __s390x__ */
22 __kernel_time_t shm_dtime; /* last detach time */
23#ifndef __s390x__
24 unsigned long __unused2;
25#endif /* ! __s390x__ */
26 __kernel_time_t shm_ctime; /* last change time */
27#ifndef __s390x__
28 unsigned long __unused3;
29#endif /* ! __s390x__ */
30 __kernel_pid_t shm_cpid; /* pid of creator */
31 __kernel_pid_t shm_lpid; /* pid of last operator */
32 unsigned long shm_nattch; /* no. of current attaches */
33 unsigned long __unused4;
34 unsigned long __unused5;
35};
36
37struct shminfo64 {
38 unsigned long shmmax;
39 unsigned long shmmin;
40 unsigned long shmmni;
41 unsigned long shmseg;
42 unsigned long shmall;
43 unsigned long __unused1;
44 unsigned long __unused2;
45 unsigned long __unused3;
46 unsigned long __unused4;
47};
48
49#endif /* _S390_SHMBUF_H */
diff --git a/arch/sparc/include/asm/compat.h b/arch/sparc/include/asm/compat.h
index 1910c44521e3..4eb51d2dae98 100644
--- a/arch/sparc/include/asm/compat.h
+++ b/arch/sparc/include/asm/compat.h
@@ -192,10 +192,10 @@ struct compat_ipc64_perm {
192 192
193struct compat_semid64_ds { 193struct compat_semid64_ds {
194 struct compat_ipc64_perm sem_perm; 194 struct compat_ipc64_perm sem_perm;
195 unsigned int __pad1; 195 unsigned int sem_otime_high;
196 compat_time_t sem_otime; 196 unsigned int sem_otime;
197 unsigned int __pad2; 197 unsigned int sem_ctime_high;
198 compat_time_t sem_ctime; 198 unsigned int sem_ctime;
199 u32 sem_nsems; 199 u32 sem_nsems;
200 u32 __unused1; 200 u32 __unused1;
201 u32 __unused2; 201 u32 __unused2;
@@ -203,12 +203,12 @@ struct compat_semid64_ds {
203 203
204struct compat_msqid64_ds { 204struct compat_msqid64_ds {
205 struct compat_ipc64_perm msg_perm; 205 struct compat_ipc64_perm msg_perm;
206 unsigned int __pad1; 206 unsigned int msg_stime_high;
207 compat_time_t msg_stime; 207 unsigned int msg_stime;
208 unsigned int __pad2; 208 unsigned int msg_rtime_high;
209 compat_time_t msg_rtime; 209 unsigned int msg_rtime;
210 unsigned int __pad3; 210 unsigned int msg_ctime_high;
211 compat_time_t msg_ctime; 211 unsigned int msg_ctime;
212 unsigned int msg_cbytes; 212 unsigned int msg_cbytes;
213 unsigned int msg_qnum; 213 unsigned int msg_qnum;
214 unsigned int msg_qbytes; 214 unsigned int msg_qbytes;
@@ -220,12 +220,12 @@ struct compat_msqid64_ds {
220 220
221struct compat_shmid64_ds { 221struct compat_shmid64_ds {
222 struct compat_ipc64_perm shm_perm; 222 struct compat_ipc64_perm shm_perm;
223 unsigned int __pad1; 223 unsigned int shm_atime_high;
224 compat_time_t shm_atime; 224 unsigned int shm_atime;
225 unsigned int __pad2; 225 unsigned int shm_dtime_high;
226 compat_time_t shm_dtime; 226 unsigned int shm_dtime;
227 unsigned int __pad3; 227 unsigned int shm_ctime_high;
228 compat_time_t shm_ctime; 228 unsigned int shm_ctime;
229 compat_size_t shm_segsz; 229 compat_size_t shm_segsz;
230 compat_pid_t shm_cpid; 230 compat_pid_t shm_cpid;
231 compat_pid_t shm_lpid; 231 compat_pid_t shm_lpid;
diff --git a/arch/sparc/include/uapi/asm/msgbuf.h b/arch/sparc/include/uapi/asm/msgbuf.h
index b601c4f4d956..ffc46c211d6d 100644
--- a/arch/sparc/include/uapi/asm/msgbuf.h
+++ b/arch/sparc/include/uapi/asm/msgbuf.h
@@ -8,25 +8,22 @@
8 * between kernel and user space. 8 * between kernel and user space.
9 * 9 *
10 * Pad space is left for: 10 * Pad space is left for:
11 * - 64-bit time_t to solve y2038 problem
12 * - 2 miscellaneous 32-bit values 11 * - 2 miscellaneous 32-bit values
13 */ 12 */
14
15#if defined(__sparc__) && defined(__arch64__)
16# define PADDING(x)
17#else
18# define PADDING(x) unsigned int x;
19#endif
20
21
22struct msqid64_ds { 13struct msqid64_ds {
23 struct ipc64_perm msg_perm; 14 struct ipc64_perm msg_perm;
24 PADDING(__pad1) 15#if defined(__sparc__) && defined(__arch64__)
25 __kernel_time_t msg_stime; /* last msgsnd time */ 16 __kernel_time_t msg_stime; /* last msgsnd time */
26 PADDING(__pad2)
27 __kernel_time_t msg_rtime; /* last msgrcv time */ 17 __kernel_time_t msg_rtime; /* last msgrcv time */
28 PADDING(__pad3)
29 __kernel_time_t msg_ctime; /* last change time */ 18 __kernel_time_t msg_ctime; /* last change time */
19#else
20 unsigned long msg_stime_high;
21 unsigned long msg_stime; /* last msgsnd time */
22 unsigned long msg_rtime_high;
23 unsigned long msg_rtime; /* last msgrcv time */
24 unsigned long msg_ctime_high;
25 unsigned long msg_ctime; /* last change time */
26#endif
30 unsigned long msg_cbytes; /* current number of bytes on queue */ 27 unsigned long msg_cbytes; /* current number of bytes on queue */
31 unsigned long msg_qnum; /* number of messages in queue */ 28 unsigned long msg_qnum; /* number of messages in queue */
32 unsigned long msg_qbytes; /* max number of bytes on queue */ 29 unsigned long msg_qbytes; /* max number of bytes on queue */
@@ -35,5 +32,4 @@ struct msqid64_ds {
35 unsigned long __unused1; 32 unsigned long __unused1;
36 unsigned long __unused2; 33 unsigned long __unused2;
37}; 34};
38#undef PADDING
39#endif /* _SPARC_MSGBUF_H */ 35#endif /* _SPARC_MSGBUF_H */
diff --git a/arch/sparc/include/uapi/asm/sembuf.h b/arch/sparc/include/uapi/asm/sembuf.h
index f49b0ffa0ab8..f3d309c2e1cd 100644
--- a/arch/sparc/include/uapi/asm/sembuf.h
+++ b/arch/sparc/include/uapi/asm/sembuf.h
@@ -8,25 +8,23 @@
8 * between kernel and user space. 8 * between kernel and user space.
9 * 9 *
10 * Pad space is left for: 10 * Pad space is left for:
11 * - 64-bit time_t to solve y2038 problem
12 * - 2 miscellaneous 32-bit values 11 * - 2 miscellaneous 32-bit values
13 */ 12 */
14#if defined(__sparc__) && defined(__arch64__)
15# define PADDING(x)
16#else
17# define PADDING(x) unsigned int x;
18#endif
19 13
20struct semid64_ds { 14struct semid64_ds {
21 struct ipc64_perm sem_perm; /* permissions .. see ipc.h */ 15 struct ipc64_perm sem_perm; /* permissions .. see ipc.h */
22 PADDING(__pad1) 16#if defined(__sparc__) && defined(__arch64__)
23 __kernel_time_t sem_otime; /* last semop time */ 17 __kernel_time_t sem_otime; /* last semop time */
24 PADDING(__pad2)
25 __kernel_time_t sem_ctime; /* last change time */ 18 __kernel_time_t sem_ctime; /* last change time */
19#else
20 unsigned long sem_otime_high;
21 unsigned long sem_otime; /* last semop time */
22 unsigned long sem_ctime_high;
23 unsigned long sem_ctime; /* last change time */
24#endif
26 unsigned long sem_nsems; /* no. of semaphores in array */ 25 unsigned long sem_nsems; /* no. of semaphores in array */
27 unsigned long __unused1; 26 unsigned long __unused1;
28 unsigned long __unused2; 27 unsigned long __unused2;
29}; 28};
30#undef PADDING
31 29
32#endif /* _SPARC64_SEMBUF_H */ 30#endif /* _SPARC64_SEMBUF_H */
diff --git a/arch/sparc/include/uapi/asm/shmbuf.h b/arch/sparc/include/uapi/asm/shmbuf.h
index 286631db705c..06618b84822d 100644
--- a/arch/sparc/include/uapi/asm/shmbuf.h
+++ b/arch/sparc/include/uapi/asm/shmbuf.h
@@ -8,24 +8,23 @@
8 * between kernel and user space. 8 * between kernel and user space.
9 * 9 *
10 * Pad space is left for: 10 * Pad space is left for:
11 * - 64-bit time_t to solve y2038 problem
12 * - 2 miscellaneous 32-bit values 11 * - 2 miscellaneous 32-bit values
13 */ 12 */
14 13
15#if defined(__sparc__) && defined(__arch64__)
16# define PADDING(x)
17#else
18# define PADDING(x) unsigned int x;
19#endif
20
21struct shmid64_ds { 14struct shmid64_ds {
22 struct ipc64_perm shm_perm; /* operation perms */ 15 struct ipc64_perm shm_perm; /* operation perms */
23 PADDING(__pad1) 16#if defined(__sparc__) && defined(__arch64__)
24 __kernel_time_t shm_atime; /* last attach time */ 17 __kernel_time_t shm_atime; /* last attach time */
25 PADDING(__pad2)
26 __kernel_time_t shm_dtime; /* last detach time */ 18 __kernel_time_t shm_dtime; /* last detach time */
27 PADDING(__pad3)
28 __kernel_time_t shm_ctime; /* last change time */ 19 __kernel_time_t shm_ctime; /* last change time */
20#else
21 unsigned long shm_atime_high;
22 unsigned long shm_atime; /* last attach time */
23 unsigned long shm_dtime_high;
24 unsigned long shm_dtime; /* last detach time */
25 unsigned long shm_ctime_high;
26 unsigned long shm_ctime; /* last change time */
27#endif
29 size_t shm_segsz; /* size of segment (bytes) */ 28 size_t shm_segsz; /* size of segment (bytes) */
30 __kernel_pid_t shm_cpid; /* pid of creator */ 29 __kernel_pid_t shm_cpid; /* pid of creator */
31 __kernel_pid_t shm_lpid; /* pid of last operator */ 30 __kernel_pid_t shm_lpid; /* pid of last operator */
@@ -46,6 +45,4 @@ struct shminfo64 {
46 unsigned long __unused4; 45 unsigned long __unused4;
47}; 46};
48 47
49#undef PADDING
50
51#endif /* _SPARC_SHMBUF_H */ 48#endif /* _SPARC_SHMBUF_H */
diff --git a/arch/x86/include/asm/compat.h b/arch/x86/include/asm/compat.h
index 7cd314b71c51..fb97cf7c4137 100644
--- a/arch/x86/include/asm/compat.h
+++ b/arch/x86/include/asm/compat.h
@@ -134,10 +134,10 @@ struct compat_ipc64_perm {
134 134
135struct compat_semid64_ds { 135struct compat_semid64_ds {
136 struct compat_ipc64_perm sem_perm; 136 struct compat_ipc64_perm sem_perm;
137 compat_time_t sem_otime; 137 compat_ulong_t sem_otime;
138 compat_ulong_t __unused1; 138 compat_ulong_t sem_otime_high;
139 compat_time_t sem_ctime; 139 compat_ulong_t sem_ctime;
140 compat_ulong_t __unused2; 140 compat_ulong_t sem_ctime_high;
141 compat_ulong_t sem_nsems; 141 compat_ulong_t sem_nsems;
142 compat_ulong_t __unused3; 142 compat_ulong_t __unused3;
143 compat_ulong_t __unused4; 143 compat_ulong_t __unused4;
@@ -145,12 +145,12 @@ struct compat_semid64_ds {
145 145
146struct compat_msqid64_ds { 146struct compat_msqid64_ds {
147 struct compat_ipc64_perm msg_perm; 147 struct compat_ipc64_perm msg_perm;
148 compat_time_t msg_stime; 148 compat_ulong_t msg_stime;
149 compat_ulong_t __unused1; 149 compat_ulong_t msg_stime_high;
150 compat_time_t msg_rtime; 150 compat_ulong_t msg_rtime;
151 compat_ulong_t __unused2; 151 compat_ulong_t msg_rtime_high;
152 compat_time_t msg_ctime; 152 compat_ulong_t msg_ctime;
153 compat_ulong_t __unused3; 153 compat_ulong_t msg_ctime_high;
154 compat_ulong_t msg_cbytes; 154 compat_ulong_t msg_cbytes;
155 compat_ulong_t msg_qnum; 155 compat_ulong_t msg_qnum;
156 compat_ulong_t msg_qbytes; 156 compat_ulong_t msg_qbytes;
@@ -163,12 +163,12 @@ struct compat_msqid64_ds {
163struct compat_shmid64_ds { 163struct compat_shmid64_ds {
164 struct compat_ipc64_perm shm_perm; 164 struct compat_ipc64_perm shm_perm;
165 compat_size_t shm_segsz; 165 compat_size_t shm_segsz;
166 compat_time_t shm_atime; 166 compat_ulong_t shm_atime;
167 compat_ulong_t __unused1; 167 compat_ulong_t shm_atime_high;
168 compat_time_t shm_dtime; 168 compat_ulong_t shm_dtime;
169 compat_ulong_t __unused2; 169 compat_ulong_t shm_dtime_high;
170 compat_time_t shm_ctime; 170 compat_ulong_t shm_ctime;
171 compat_ulong_t __unused3; 171 compat_ulong_t shm_ctime_high;
172 compat_pid_t shm_cpid; 172 compat_pid_t shm_cpid;
173 compat_pid_t shm_lpid; 173 compat_pid_t shm_lpid;
174 compat_ulong_t shm_nattch; 174 compat_ulong_t shm_nattch;
diff --git a/arch/x86/include/asm/intel_mid_vrtc.h b/arch/x86/include/asm/intel_mid_vrtc.h
index 35555016b1be..0b44b1abe4d9 100644
--- a/arch/x86/include/asm/intel_mid_vrtc.h
+++ b/arch/x86/include/asm/intel_mid_vrtc.h
@@ -4,7 +4,7 @@
4 4
5extern unsigned char vrtc_cmos_read(unsigned char reg); 5extern unsigned char vrtc_cmos_read(unsigned char reg);
6extern void vrtc_cmos_write(unsigned char val, unsigned char reg); 6extern void vrtc_cmos_write(unsigned char val, unsigned char reg);
7extern void vrtc_get_time(struct timespec *now); 7extern void vrtc_get_time(struct timespec64 *now);
8extern int vrtc_set_mmss(const struct timespec *now); 8extern int vrtc_set_mmss(const struct timespec64 *now);
9 9
10#endif 10#endif
diff --git a/arch/x86/include/asm/mc146818rtc.h b/arch/x86/include/asm/mc146818rtc.h
index 1775a32f7ea6..97198001e567 100644
--- a/arch/x86/include/asm/mc146818rtc.h
+++ b/arch/x86/include/asm/mc146818rtc.h
@@ -95,8 +95,8 @@ static inline unsigned char current_lock_cmos_reg(void)
95unsigned char rtc_cmos_read(unsigned char addr); 95unsigned char rtc_cmos_read(unsigned char addr);
96void rtc_cmos_write(unsigned char val, unsigned char addr); 96void rtc_cmos_write(unsigned char val, unsigned char addr);
97 97
98extern int mach_set_rtc_mmss(const struct timespec *now); 98extern int mach_set_rtc_mmss(const struct timespec64 *now);
99extern void mach_get_cmos_time(struct timespec *now); 99extern void mach_get_cmos_time(struct timespec64 *now);
100 100
101#define RTC_IRQ 8 101#define RTC_IRQ 8
102 102
diff --git a/arch/x86/include/asm/pvclock.h b/arch/x86/include/asm/pvclock.h
index a7471dcd2205..b6033680d458 100644
--- a/arch/x86/include/asm/pvclock.h
+++ b/arch/x86/include/asm/pvclock.h
@@ -12,7 +12,7 @@ void pvclock_set_flags(u8 flags);
12unsigned long pvclock_tsc_khz(struct pvclock_vcpu_time_info *src); 12unsigned long pvclock_tsc_khz(struct pvclock_vcpu_time_info *src);
13void pvclock_read_wallclock(struct pvclock_wall_clock *wall, 13void pvclock_read_wallclock(struct pvclock_wall_clock *wall,
14 struct pvclock_vcpu_time_info *vcpu, 14 struct pvclock_vcpu_time_info *vcpu,
15 struct timespec *ts); 15 struct timespec64 *ts);
16void pvclock_resume(void); 16void pvclock_resume(void);
17 17
18void pvclock_touch_watchdogs(void); 18void pvclock_touch_watchdogs(void);
diff --git a/arch/x86/include/asm/x86_init.h b/arch/x86/include/asm/x86_init.h
index ce8b4da07e35..2d27236c16a3 100644
--- a/arch/x86/include/asm/x86_init.h
+++ b/arch/x86/include/asm/x86_init.h
@@ -170,7 +170,7 @@ struct x86_cpuinit_ops {
170 void (*fixup_cpu_id)(struct cpuinfo_x86 *c, int node); 170 void (*fixup_cpu_id)(struct cpuinfo_x86 *c, int node);
171}; 171};
172 172
173struct timespec; 173struct timespec64;
174 174
175/** 175/**
176 * struct x86_legacy_devices - legacy x86 devices 176 * struct x86_legacy_devices - legacy x86 devices
@@ -264,8 +264,8 @@ struct x86_hyper_runtime {
264struct x86_platform_ops { 264struct x86_platform_ops {
265 unsigned long (*calibrate_cpu)(void); 265 unsigned long (*calibrate_cpu)(void);
266 unsigned long (*calibrate_tsc)(void); 266 unsigned long (*calibrate_tsc)(void);
267 void (*get_wallclock)(struct timespec *ts); 267 void (*get_wallclock)(struct timespec64 *ts);
268 int (*set_wallclock)(const struct timespec *ts); 268 int (*set_wallclock)(const struct timespec64 *ts);
269 void (*iommu_shutdown)(void); 269 void (*iommu_shutdown)(void);
270 bool (*is_untracked_pat_range)(u64 start, u64 end); 270 bool (*is_untracked_pat_range)(u64 start, u64 end);
271 void (*nmi_init)(void); 271 void (*nmi_init)(void);
diff --git a/arch/x86/include/uapi/asm/sembuf.h b/arch/x86/include/uapi/asm/sembuf.h
index cabd7476bd6c..89de6cd9f0a7 100644
--- a/arch/x86/include/uapi/asm/sembuf.h
+++ b/arch/x86/include/uapi/asm/sembuf.h
@@ -8,15 +8,24 @@
8 * between kernel and user space. 8 * between kernel and user space.
9 * 9 *
10 * Pad space is left for: 10 * Pad space is left for:
11 * - 64-bit time_t to solve y2038 problem
12 * - 2 miscellaneous 32-bit values 11 * - 2 miscellaneous 32-bit values
12 *
13 * x86_64 and x32 incorrectly added padding here, so the structures
14 * are still incompatible with the padding on x86.
13 */ 15 */
14struct semid64_ds { 16struct semid64_ds {
15 struct ipc64_perm sem_perm; /* permissions .. see ipc.h */ 17 struct ipc64_perm sem_perm; /* permissions .. see ipc.h */
18#ifdef __i386__
19 unsigned long sem_otime; /* last semop time */
20 unsigned long sem_otime_high;
21 unsigned long sem_ctime; /* last change time */
22 unsigned long sem_ctime_high;
23#else
16 __kernel_time_t sem_otime; /* last semop time */ 24 __kernel_time_t sem_otime; /* last semop time */
17 __kernel_ulong_t __unused1; 25 __kernel_ulong_t __unused1;
18 __kernel_time_t sem_ctime; /* last change time */ 26 __kernel_time_t sem_ctime; /* last change time */
19 __kernel_ulong_t __unused2; 27 __kernel_ulong_t __unused2;
28#endif
20 __kernel_ulong_t sem_nsems; /* no. of semaphores in array */ 29 __kernel_ulong_t sem_nsems; /* no. of semaphores in array */
21 __kernel_ulong_t __unused3; 30 __kernel_ulong_t __unused3;
22 __kernel_ulong_t __unused4; 31 __kernel_ulong_t __unused4;
diff --git a/arch/x86/kernel/jailhouse.c b/arch/x86/kernel/jailhouse.c
index a15fe0e92cf9..108c48d0d40e 100644
--- a/arch/x86/kernel/jailhouse.c
+++ b/arch/x86/kernel/jailhouse.c
@@ -37,7 +37,7 @@ static uint32_t __init jailhouse_detect(void)
37 return jailhouse_cpuid_base(); 37 return jailhouse_cpuid_base();
38} 38}
39 39
40static void jailhouse_get_wallclock(struct timespec *now) 40static void jailhouse_get_wallclock(struct timespec64 *now)
41{ 41{
42 memset(now, 0, sizeof(*now)); 42 memset(now, 0, sizeof(*now));
43} 43}
diff --git a/arch/x86/kernel/kvmclock.c b/arch/x86/kernel/kvmclock.c
index 8b26c9e01cc4..bf8d1eb7fca3 100644
--- a/arch/x86/kernel/kvmclock.c
+++ b/arch/x86/kernel/kvmclock.c
@@ -53,7 +53,7 @@ static struct pvclock_wall_clock *wall_clock;
53 * have elapsed since the hypervisor wrote the data. So we try to account for 53 * have elapsed since the hypervisor wrote the data. So we try to account for
54 * that with system time 54 * that with system time
55 */ 55 */
56static void kvm_get_wallclock(struct timespec *now) 56static void kvm_get_wallclock(struct timespec64 *now)
57{ 57{
58 struct pvclock_vcpu_time_info *vcpu_time; 58 struct pvclock_vcpu_time_info *vcpu_time;
59 int low, high; 59 int low, high;
@@ -72,7 +72,7 @@ static void kvm_get_wallclock(struct timespec *now)
72 put_cpu(); 72 put_cpu();
73} 73}
74 74
75static int kvm_set_wallclock(const struct timespec *now) 75static int kvm_set_wallclock(const struct timespec64 *now)
76{ 76{
77 return -ENODEV; 77 return -ENODEV;
78} 78}
diff --git a/arch/x86/kernel/pvclock.c b/arch/x86/kernel/pvclock.c
index 761f6af6efa5..637982efecd8 100644
--- a/arch/x86/kernel/pvclock.c
+++ b/arch/x86/kernel/pvclock.c
@@ -123,28 +123,35 @@ u64 pvclock_clocksource_read(struct pvclock_vcpu_time_info *src)
123 123
124void pvclock_read_wallclock(struct pvclock_wall_clock *wall_clock, 124void pvclock_read_wallclock(struct pvclock_wall_clock *wall_clock,
125 struct pvclock_vcpu_time_info *vcpu_time, 125 struct pvclock_vcpu_time_info *vcpu_time,
126 struct timespec *ts) 126 struct timespec64 *ts)
127{ 127{
128 u32 version; 128 u32 version;
129 u64 delta; 129 u64 delta;
130 struct timespec now; 130 struct timespec64 now;
131 131
132 /* get wallclock at system boot */ 132 /* get wallclock at system boot */
133 do { 133 do {
134 version = wall_clock->version; 134 version = wall_clock->version;
135 rmb(); /* fetch version before time */ 135 rmb(); /* fetch version before time */
136 /*
137 * Note: wall_clock->sec is a u32 value, so it can
138 * only store dates between 1970 and 2106. To allow
139 * times beyond that, we need to create a new hypercall
140 * interface with an extended pvclock_wall_clock structure
141 * like ARM has.
142 */
136 now.tv_sec = wall_clock->sec; 143 now.tv_sec = wall_clock->sec;
137 now.tv_nsec = wall_clock->nsec; 144 now.tv_nsec = wall_clock->nsec;
138 rmb(); /* fetch time before checking version */ 145 rmb(); /* fetch time before checking version */
139 } while ((wall_clock->version & 1) || (version != wall_clock->version)); 146 } while ((wall_clock->version & 1) || (version != wall_clock->version));
140 147
141 delta = pvclock_clocksource_read(vcpu_time); /* time since system boot */ 148 delta = pvclock_clocksource_read(vcpu_time); /* time since system boot */
142 delta += now.tv_sec * (u64)NSEC_PER_SEC + now.tv_nsec; 149 delta += now.tv_sec * NSEC_PER_SEC + now.tv_nsec;
143 150
144 now.tv_nsec = do_div(delta, NSEC_PER_SEC); 151 now.tv_nsec = do_div(delta, NSEC_PER_SEC);
145 now.tv_sec = delta; 152 now.tv_sec = delta;
146 153
147 set_normalized_timespec(ts, now.tv_sec, now.tv_nsec); 154 set_normalized_timespec64(ts, now.tv_sec, now.tv_nsec);
148} 155}
149 156
150void pvclock_set_pvti_cpu0_va(struct pvclock_vsyscall_time_info *pvti) 157void pvclock_set_pvti_cpu0_va(struct pvclock_vsyscall_time_info *pvti)
diff --git a/arch/x86/kernel/rtc.c b/arch/x86/kernel/rtc.c
index f7b82ed7b5b5..586f718b8e95 100644
--- a/arch/x86/kernel/rtc.c
+++ b/arch/x86/kernel/rtc.c
@@ -39,7 +39,7 @@ EXPORT_SYMBOL(rtc_lock);
39 * jump to the next second precisely 500 ms later. Check the Motorola 39 * jump to the next second precisely 500 ms later. Check the Motorola
40 * MC146818A or Dallas DS12887 data sheet for details. 40 * MC146818A or Dallas DS12887 data sheet for details.
41 */ 41 */
42int mach_set_rtc_mmss(const struct timespec *now) 42int mach_set_rtc_mmss(const struct timespec64 *now)
43{ 43{
44 unsigned long long nowtime = now->tv_sec; 44 unsigned long long nowtime = now->tv_sec;
45 struct rtc_time tm; 45 struct rtc_time tm;
@@ -60,7 +60,7 @@ int mach_set_rtc_mmss(const struct timespec *now)
60 return retval; 60 return retval;
61} 61}
62 62
63void mach_get_cmos_time(struct timespec *now) 63void mach_get_cmos_time(struct timespec64 *now)
64{ 64{
65 unsigned int status, year, mon, day, hour, min, sec, century = 0; 65 unsigned int status, year, mon, day, hour, min, sec, century = 0;
66 unsigned long flags; 66 unsigned long flags;
@@ -118,7 +118,7 @@ void mach_get_cmos_time(struct timespec *now)
118 } else 118 } else
119 year += CMOS_YEARS_OFFS; 119 year += CMOS_YEARS_OFFS;
120 120
121 now->tv_sec = mktime(year, mon, day, hour, min, sec); 121 now->tv_sec = mktime64(year, mon, day, hour, min, sec);
122 now->tv_nsec = 0; 122 now->tv_nsec = 0;
123} 123}
124 124
@@ -145,13 +145,13 @@ void rtc_cmos_write(unsigned char val, unsigned char addr)
145} 145}
146EXPORT_SYMBOL(rtc_cmos_write); 146EXPORT_SYMBOL(rtc_cmos_write);
147 147
148int update_persistent_clock(struct timespec now) 148int update_persistent_clock64(struct timespec64 now)
149{ 149{
150 return x86_platform.set_wallclock(&now); 150 return x86_platform.set_wallclock(&now);
151} 151}
152 152
153/* not static: needed by APM */ 153/* not static: needed by APM */
154void read_persistent_clock(struct timespec *ts) 154void read_persistent_clock64(struct timespec64 *ts)
155{ 155{
156 x86_platform.get_wallclock(ts); 156 x86_platform.get_wallclock(ts);
157} 157}
diff --git a/arch/x86/platform/intel-mid/intel_mid_vrtc.c b/arch/x86/platform/intel-mid/intel_mid_vrtc.c
index 58024862a7eb..a52914aa3b6c 100644
--- a/arch/x86/platform/intel-mid/intel_mid_vrtc.c
+++ b/arch/x86/platform/intel-mid/intel_mid_vrtc.c
@@ -57,7 +57,7 @@ void vrtc_cmos_write(unsigned char val, unsigned char reg)
57} 57}
58EXPORT_SYMBOL_GPL(vrtc_cmos_write); 58EXPORT_SYMBOL_GPL(vrtc_cmos_write);
59 59
60void vrtc_get_time(struct timespec *now) 60void vrtc_get_time(struct timespec64 *now)
61{ 61{
62 u8 sec, min, hour, mday, mon; 62 u8 sec, min, hour, mday, mon;
63 unsigned long flags; 63 unsigned long flags;
@@ -83,18 +83,18 @@ void vrtc_get_time(struct timespec *now)
83 pr_info("vRTC: sec: %d min: %d hour: %d day: %d " 83 pr_info("vRTC: sec: %d min: %d hour: %d day: %d "
84 "mon: %d year: %d\n", sec, min, hour, mday, mon, year); 84 "mon: %d year: %d\n", sec, min, hour, mday, mon, year);
85 85
86 now->tv_sec = mktime(year, mon, mday, hour, min, sec); 86 now->tv_sec = mktime64(year, mon, mday, hour, min, sec);
87 now->tv_nsec = 0; 87 now->tv_nsec = 0;
88} 88}
89 89
90int vrtc_set_mmss(const struct timespec *now) 90int vrtc_set_mmss(const struct timespec64 *now)
91{ 91{
92 unsigned long flags; 92 unsigned long flags;
93 struct rtc_time tm; 93 struct rtc_time tm;
94 int year; 94 int year;
95 int retval = 0; 95 int retval = 0;
96 96
97 rtc_time_to_tm(now->tv_sec, &tm); 97 rtc_time64_to_tm(now->tv_sec, &tm);
98 if (!rtc_valid_tm(&tm) && tm.tm_year >= 72) { 98 if (!rtc_valid_tm(&tm) && tm.tm_year >= 72) {
99 /* 99 /*
100 * tm.year is the number of years since 1900, and the 100 * tm.year is the number of years since 1900, and the
@@ -110,8 +110,8 @@ int vrtc_set_mmss(const struct timespec *now)
110 vrtc_cmos_write(tm.tm_sec, RTC_SECONDS); 110 vrtc_cmos_write(tm.tm_sec, RTC_SECONDS);
111 spin_unlock_irqrestore(&rtc_lock, flags); 111 spin_unlock_irqrestore(&rtc_lock, flags);
112 } else { 112 } else {
113 pr_err("%s: Invalid vRTC value: write of %lx to vRTC failed\n", 113 pr_err("%s: Invalid vRTC value: write of %llx to vRTC failed\n",
114 __func__, now->tv_sec); 114 __func__, (s64)now->tv_sec);
115 retval = -EINVAL; 115 retval = -EINVAL;
116 } 116 }
117 return retval; 117 return retval;
diff --git a/arch/x86/xen/time.c b/arch/x86/xen/time.c
index 29163c43ebbd..e0f1bcf01d63 100644
--- a/arch/x86/xen/time.c
+++ b/arch/x86/xen/time.c
@@ -57,7 +57,7 @@ static u64 xen_clocksource_get_cycles(struct clocksource *cs)
57 return xen_clocksource_read(); 57 return xen_clocksource_read();
58} 58}
59 59
60static void xen_read_wallclock(struct timespec *ts) 60static void xen_read_wallclock(struct timespec64 *ts)
61{ 61{
62 struct shared_info *s = HYPERVISOR_shared_info; 62 struct shared_info *s = HYPERVISOR_shared_info;
63 struct pvclock_wall_clock *wall_clock = &(s->wc); 63 struct pvclock_wall_clock *wall_clock = &(s->wc);
@@ -68,12 +68,12 @@ static void xen_read_wallclock(struct timespec *ts)
68 put_cpu_var(xen_vcpu); 68 put_cpu_var(xen_vcpu);
69} 69}
70 70
71static void xen_get_wallclock(struct timespec *now) 71static void xen_get_wallclock(struct timespec64 *now)
72{ 72{
73 xen_read_wallclock(now); 73 xen_read_wallclock(now);
74} 74}
75 75
76static int xen_set_wallclock(const struct timespec *now) 76static int xen_set_wallclock(const struct timespec64 *now)
77{ 77{
78 return -ENODEV; 78 return -ENODEV;
79} 79}
@@ -461,7 +461,7 @@ static void __init xen_time_init(void)
461{ 461{
462 struct pvclock_vcpu_time_info *pvti; 462 struct pvclock_vcpu_time_info *pvti;
463 int cpu = smp_processor_id(); 463 int cpu = smp_processor_id();
464 struct timespec tp; 464 struct timespec64 tp;
465 465
466 /* As Dom0 is never moved, no penalty on using TSC there */ 466 /* As Dom0 is never moved, no penalty on using TSC there */
467 if (xen_initial_domain()) 467 if (xen_initial_domain())
@@ -479,7 +479,7 @@ static void __init xen_time_init(void)
479 479
480 /* Set initial system time with full resolution */ 480 /* Set initial system time with full resolution */
481 xen_read_wallclock(&tp); 481 xen_read_wallclock(&tp);
482 do_settimeofday(&tp); 482 do_settimeofday64(&tp);
483 483
484 setup_force_cpu_cap(X86_FEATURE_TSC); 484 setup_force_cpu_cap(X86_FEATURE_TSC);
485 485
diff --git a/arch/xtensa/include/uapi/asm/msgbuf.h b/arch/xtensa/include/uapi/asm/msgbuf.h
index 36e2e103ca38..d6915e9f071c 100644
--- a/arch/xtensa/include/uapi/asm/msgbuf.h
+++ b/arch/xtensa/include/uapi/asm/msgbuf.h
@@ -7,7 +7,6 @@
7 * between kernel and user space. 7 * between kernel and user space.
8 * 8 *
9 * Pad space is left for: 9 * Pad space is left for:
10 * - 64-bit time_t to solve y2038 problem
11 * - 2 miscellaneous 32-bit values 10 * - 2 miscellaneous 32-bit values
12 * 11 *
13 * This file is subject to the terms and conditions of the GNU General 12 * This file is subject to the terms and conditions of the GNU General
@@ -21,19 +20,19 @@
21struct msqid64_ds { 20struct msqid64_ds {
22 struct ipc64_perm msg_perm; 21 struct ipc64_perm msg_perm;
23#ifdef __XTENSA_EB__ 22#ifdef __XTENSA_EB__
24 unsigned int __unused1; 23 unsigned long msg_stime_high;
25 __kernel_time_t msg_stime; /* last msgsnd time */ 24 unsigned long msg_stime; /* last msgsnd time */
26 unsigned int __unused2; 25 unsigned long msg_rtime_high;
27 __kernel_time_t msg_rtime; /* last msgrcv time */ 26 unsigned long msg_rtime; /* last msgrcv time */
28 unsigned int __unused3; 27 unsigned long msg_ctime_high;
29 __kernel_time_t msg_ctime; /* last change time */ 28 unsigned long msg_ctime; /* last change time */
30#elif defined(__XTENSA_EL__) 29#elif defined(__XTENSA_EL__)
31 __kernel_time_t msg_stime; /* last msgsnd time */ 30 unsigned long msg_stime; /* last msgsnd time */
32 unsigned int __unused1; 31 unsigned long msg_stime_high;
33 __kernel_time_t msg_rtime; /* last msgrcv time */ 32 unsigned long msg_rtime; /* last msgrcv time */
34 unsigned int __unused2; 33 unsigned long msg_rtime_high;
35 __kernel_time_t msg_ctime; /* last change time */ 34 unsigned long msg_ctime; /* last change time */
36 unsigned int __unused3; 35 unsigned long msg_ctime_high;
37#else 36#else
38# error processor byte order undefined! 37# error processor byte order undefined!
39#endif 38#endif
diff --git a/arch/xtensa/include/uapi/asm/sembuf.h b/arch/xtensa/include/uapi/asm/sembuf.h
index f61b6331a10c..09f348d643f1 100644
--- a/arch/xtensa/include/uapi/asm/sembuf.h
+++ b/arch/xtensa/include/uapi/asm/sembuf.h
@@ -14,7 +14,6 @@
14 * between kernel and user space. 14 * between kernel and user space.
15 * 15 *
16 * Pad space is left for: 16 * Pad space is left for:
17 * - 64-bit time_t to solve y2038 problem
18 * - 2 miscellaneous 32-bit values 17 * - 2 miscellaneous 32-bit values
19 * 18 *
20 */ 19 */
@@ -27,15 +26,15 @@
27struct semid64_ds { 26struct semid64_ds {
28 struct ipc64_perm sem_perm; /* permissions .. see ipc.h */ 27 struct ipc64_perm sem_perm; /* permissions .. see ipc.h */
29#ifdef __XTENSA_EL__ 28#ifdef __XTENSA_EL__
30 __kernel_time_t sem_otime; /* last semop time */ 29 unsigned long sem_otime; /* last semop time */
31 unsigned long __unused1; 30 unsigned long sem_otime_high;
32 __kernel_time_t sem_ctime; /* last change time */ 31 unsigned long sem_ctime; /* last change time */
33 unsigned long __unused2; 32 unsigned long sem_ctime_high;
34#else 33#else
35 unsigned long __unused1; 34 unsigned long sem_otime_high;
36 __kernel_time_t sem_otime; /* last semop time */ 35 unsigned long sem_otime; /* last semop time */
37 unsigned long __unused2; 36 unsigned long sem_ctime_high;
38 __kernel_time_t sem_ctime; /* last change time */ 37 unsigned long sem_ctime; /* last change time */
39#endif 38#endif
40 unsigned long sem_nsems; /* no. of semaphores in array */ 39 unsigned long sem_nsems; /* no. of semaphores in array */
41 unsigned long __unused3; 40 unsigned long __unused3;
diff --git a/arch/xtensa/include/uapi/asm/shmbuf.h b/arch/xtensa/include/uapi/asm/shmbuf.h
index 26550bdc8430..554a57a6a90f 100644
--- a/arch/xtensa/include/uapi/asm/shmbuf.h
+++ b/arch/xtensa/include/uapi/asm/shmbuf.h
@@ -4,10 +4,10 @@
4 * 4 *
5 * The shmid64_ds structure for Xtensa architecture. 5 * The shmid64_ds structure for Xtensa architecture.
6 * Note extra padding because this structure is passed back and forth 6 * Note extra padding because this structure is passed back and forth
7 * between kernel and user space. 7 * between kernel and user space, but the padding is on the wrong
8 * side for big-endian xtensa, for historic reasons.
8 * 9 *
9 * Pad space is left for: 10 * Pad space is left for:
10 * - 64-bit time_t to solve y2038 problem
11 * - 2 miscellaneous 32-bit values 11 * - 2 miscellaneous 32-bit values
12 * 12 *
13 * This file is subject to the terms and conditions of the GNU General Public 13 * This file is subject to the terms and conditions of the GNU General Public
@@ -20,42 +20,21 @@
20#ifndef _XTENSA_SHMBUF_H 20#ifndef _XTENSA_SHMBUF_H
21#define _XTENSA_SHMBUF_H 21#define _XTENSA_SHMBUF_H
22 22
23#if defined (__XTENSA_EL__)
24struct shmid64_ds { 23struct shmid64_ds {
25 struct ipc64_perm shm_perm; /* operation perms */ 24 struct ipc64_perm shm_perm; /* operation perms */
26 size_t shm_segsz; /* size of segment (bytes) */ 25 size_t shm_segsz; /* size of segment (bytes) */
27 __kernel_time_t shm_atime; /* last attach time */ 26 unsigned long shm_atime; /* last attach time */
28 unsigned long __unused1; 27 unsigned long shm_atime_high;
29 __kernel_time_t shm_dtime; /* last detach time */ 28 unsigned long shm_dtime; /* last detach time */
30 unsigned long __unused2; 29 unsigned long shm_dtime_high;
31 __kernel_time_t shm_ctime; /* last change time */ 30 unsigned long shm_ctime; /* last change time */
32 unsigned long __unused3; 31 unsigned long shm_ctime_high;
33 __kernel_pid_t shm_cpid; /* pid of creator */ 32 __kernel_pid_t shm_cpid; /* pid of creator */
34 __kernel_pid_t shm_lpid; /* pid of last operator */ 33 __kernel_pid_t shm_lpid; /* pid of last operator */
35 unsigned long shm_nattch; /* no. of current attaches */ 34 unsigned long shm_nattch; /* no. of current attaches */
36 unsigned long __unused4; 35 unsigned long __unused4;
37 unsigned long __unused5; 36 unsigned long __unused5;
38}; 37};
39#elif defined (__XTENSA_EB__)
40struct shmid64_ds {
41 struct ipc64_perm shm_perm; /* operation perms */
42 size_t shm_segsz; /* size of segment (bytes) */
43 __kernel_time_t shm_atime; /* last attach time */
44 unsigned long __unused1;
45 __kernel_time_t shm_dtime; /* last detach time */
46 unsigned long __unused2;
47 __kernel_time_t shm_ctime; /* last change time */
48 unsigned long __unused3;
49 __kernel_pid_t shm_cpid; /* pid of creator */
50 __kernel_pid_t shm_lpid; /* pid of last operator */
51 unsigned long shm_nattch; /* no. of current attaches */
52 unsigned long __unused4;
53 unsigned long __unused5;
54};
55#else
56# error endian order not defined
57#endif
58
59 38
60struct shminfo64 { 39struct shminfo64 {
61 unsigned long shmmax; 40 unsigned long shmmax;
diff --git a/include/linux/syscalls.h b/include/linux/syscalls.h
index 796ea267f1c7..390e814fdc8d 100644
--- a/include/linux/syscalls.h
+++ b/include/linux/syscalls.h
@@ -686,8 +686,8 @@ asmlinkage long sys_sysinfo(struct sysinfo __user *info);
686/* ipc/mqueue.c */ 686/* ipc/mqueue.c */
687asmlinkage long sys_mq_open(const char __user *name, int oflag, umode_t mode, struct mq_attr __user *attr); 687asmlinkage long sys_mq_open(const char __user *name, int oflag, umode_t mode, struct mq_attr __user *attr);
688asmlinkage long sys_mq_unlink(const char __user *name); 688asmlinkage long sys_mq_unlink(const char __user *name);
689asmlinkage long sys_mq_timedsend(mqd_t mqdes, const char __user *msg_ptr, size_t msg_len, unsigned int msg_prio, const struct timespec __user *abs_timeout); 689asmlinkage long sys_mq_timedsend(mqd_t mqdes, const char __user *msg_ptr, size_t msg_len, unsigned int msg_prio, const struct __kernel_timespec __user *abs_timeout);
690asmlinkage long sys_mq_timedreceive(mqd_t mqdes, char __user *msg_ptr, size_t msg_len, unsigned int __user *msg_prio, const struct timespec __user *abs_timeout); 690asmlinkage long sys_mq_timedreceive(mqd_t mqdes, char __user *msg_ptr, size_t msg_len, unsigned int __user *msg_prio, const struct __kernel_timespec __user *abs_timeout);
691asmlinkage long sys_mq_notify(mqd_t mqdes, const struct sigevent __user *notification); 691asmlinkage long sys_mq_notify(mqd_t mqdes, const struct sigevent __user *notification);
692asmlinkage long sys_mq_getsetattr(mqd_t mqdes, const struct mq_attr __user *mqstat, struct mq_attr __user *omqstat); 692asmlinkage long sys_mq_getsetattr(mqd_t mqdes, const struct mq_attr __user *mqstat, struct mq_attr __user *omqstat);
693 693
@@ -704,7 +704,7 @@ asmlinkage long sys_semget(key_t key, int nsems, int semflg);
704asmlinkage long sys_semctl(int semid, int semnum, int cmd, unsigned long arg); 704asmlinkage long sys_semctl(int semid, int semnum, int cmd, unsigned long arg);
705asmlinkage long sys_semtimedop(int semid, struct sembuf __user *sops, 705asmlinkage long sys_semtimedop(int semid, struct sembuf __user *sops,
706 unsigned nsops, 706 unsigned nsops,
707 const struct timespec __user *timeout); 707 const struct __kernel_timespec __user *timeout);
708asmlinkage long sys_semop(int semid, struct sembuf __user *sops, 708asmlinkage long sys_semop(int semid, struct sembuf __user *sops,
709 unsigned nsops); 709 unsigned nsops);
710 710
diff --git a/include/linux/time32.h b/include/linux/time32.h
index d2bcd4377b56..0b14f936100a 100644
--- a/include/linux/time32.h
+++ b/include/linux/time32.h
@@ -18,25 +18,14 @@
18/* timespec64 is defined as timespec here */ 18/* timespec64 is defined as timespec here */
19static inline struct timespec timespec64_to_timespec(const struct timespec64 ts64) 19static inline struct timespec timespec64_to_timespec(const struct timespec64 ts64)
20{ 20{
21 return ts64; 21 return *(const struct timespec *)&ts64;
22} 22}
23 23
24static inline struct timespec64 timespec_to_timespec64(const struct timespec ts) 24static inline struct timespec64 timespec_to_timespec64(const struct timespec ts)
25{ 25{
26 return ts; 26 return *(const struct timespec64 *)&ts;
27} 27}
28 28
29# define timespec_equal timespec64_equal
30# define timespec_compare timespec64_compare
31# define set_normalized_timespec set_normalized_timespec64
32# define timespec_add timespec64_add
33# define timespec_sub timespec64_sub
34# define timespec_valid timespec64_valid
35# define timespec_valid_strict timespec64_valid_strict
36# define timespec_to_ns timespec64_to_ns
37# define ns_to_timespec ns_to_timespec64
38# define timespec_add_ns timespec64_add_ns
39
40#else 29#else
41static inline struct timespec timespec64_to_timespec(const struct timespec64 ts64) 30static inline struct timespec timespec64_to_timespec(const struct timespec64 ts64)
42{ 31{
@@ -55,6 +44,7 @@ static inline struct timespec64 timespec_to_timespec64(const struct timespec ts)
55 ret.tv_nsec = ts.tv_nsec; 44 ret.tv_nsec = ts.tv_nsec;
56 return ret; 45 return ret;
57} 46}
47#endif
58 48
59static inline int timespec_equal(const struct timespec *a, 49static inline int timespec_equal(const struct timespec *a,
60 const struct timespec *b) 50 const struct timespec *b)
@@ -159,8 +149,6 @@ static __always_inline void timespec_add_ns(struct timespec *a, u64 ns)
159 a->tv_nsec = ns; 149 a->tv_nsec = ns;
160} 150}
161 151
162#endif
163
164/** 152/**
165 * time_to_tm - converts the calendar time to local broken-down time 153 * time_to_tm - converts the calendar time to local broken-down time
166 * 154 *
diff --git a/include/linux/time64.h b/include/linux/time64.h
index 0d96887ba4e0..0a7b2f79cec7 100644
--- a/include/linux/time64.h
+++ b/include/linux/time64.h
@@ -16,11 +16,6 @@ typedef __u64 timeu64_t;
16 16
17#include <uapi/linux/time.h> 17#include <uapi/linux/time.h>
18 18
19#if __BITS_PER_LONG == 64
20/* this trick allows us to optimize out timespec64_to_timespec */
21# define timespec64 timespec
22#define itimerspec64 itimerspec
23#else
24struct timespec64 { 19struct timespec64 {
25 time64_t tv_sec; /* seconds */ 20 time64_t tv_sec; /* seconds */
26 long tv_nsec; /* nanoseconds */ 21 long tv_nsec; /* nanoseconds */
@@ -31,8 +26,6 @@ struct itimerspec64 {
31 struct timespec64 it_value; 26 struct timespec64 it_value;
32}; 27};
33 28
34#endif
35
36/* Parameters used to convert the timespec values: */ 29/* Parameters used to convert the timespec values: */
37#define MSEC_PER_SEC 1000L 30#define MSEC_PER_SEC 1000L
38#define USEC_PER_MSEC 1000L 31#define USEC_PER_MSEC 1000L
diff --git a/include/linux/timekeeping.h b/include/linux/timekeeping.h
index 588a0e4b1ab9..86bc2026efce 100644
--- a/include/linux/timekeeping.h
+++ b/include/linux/timekeeping.h
@@ -19,27 +19,25 @@ extern void xtime_update(unsigned long ticks);
19extern int do_settimeofday64(const struct timespec64 *ts); 19extern int do_settimeofday64(const struct timespec64 *ts);
20extern int do_sys_settimeofday64(const struct timespec64 *tv, 20extern int do_sys_settimeofday64(const struct timespec64 *tv,
21 const struct timezone *tz); 21 const struct timezone *tz);
22/*
23 * Kernel time accessors
24 */
25struct timespec64 current_kernel_time64(void);
26 22
27/* 23/*
28 * timespec64 based interfaces 24 * timespec64 based interfaces
29 */ 25 */
30struct timespec64 get_monotonic_coarse64(void); 26extern void ktime_get_raw_ts64(struct timespec64 *ts);
31extern void getrawmonotonic64(struct timespec64 *ts);
32extern void ktime_get_ts64(struct timespec64 *ts); 27extern void ktime_get_ts64(struct timespec64 *ts);
28extern void ktime_get_real_ts64(struct timespec64 *tv);
29extern void ktime_get_coarse_ts64(struct timespec64 *ts);
30extern void ktime_get_coarse_real_ts64(struct timespec64 *ts);
31
32void getboottime64(struct timespec64 *ts);
33
34/*
35 * time64_t base interfaces
36 */
33extern time64_t ktime_get_seconds(void); 37extern time64_t ktime_get_seconds(void);
34extern time64_t __ktime_get_real_seconds(void); 38extern time64_t __ktime_get_real_seconds(void);
35extern time64_t ktime_get_real_seconds(void); 39extern time64_t ktime_get_real_seconds(void);
36 40
37extern int __getnstimeofday64(struct timespec64 *tv);
38extern void getnstimeofday64(struct timespec64 *tv);
39extern void getboottime64(struct timespec64 *ts);
40
41#define ktime_get_real_ts64(ts) getnstimeofday64(ts)
42
43/* 41/*
44 * ktime_t based interfaces 42 * ktime_t based interfaces
45 */ 43 */
@@ -53,6 +51,7 @@ enum tk_offsets {
53 51
54extern ktime_t ktime_get(void); 52extern ktime_t ktime_get(void);
55extern ktime_t ktime_get_with_offset(enum tk_offsets offs); 53extern ktime_t ktime_get_with_offset(enum tk_offsets offs);
54extern ktime_t ktime_get_coarse_with_offset(enum tk_offsets offs);
56extern ktime_t ktime_mono_to_any(ktime_t tmono, enum tk_offsets offs); 55extern ktime_t ktime_mono_to_any(ktime_t tmono, enum tk_offsets offs);
57extern ktime_t ktime_get_raw(void); 56extern ktime_t ktime_get_raw(void);
58extern u32 ktime_get_resolution_ns(void); 57extern u32 ktime_get_resolution_ns(void);
@@ -65,6 +64,11 @@ static inline ktime_t ktime_get_real(void)
65 return ktime_get_with_offset(TK_OFFS_REAL); 64 return ktime_get_with_offset(TK_OFFS_REAL);
66} 65}
67 66
67static inline ktime_t ktime_get_coarse_real(void)
68{
69 return ktime_get_coarse_with_offset(TK_OFFS_REAL);
70}
71
68/** 72/**
69 * ktime_get_boottime - Returns monotonic time since boot in ktime_t format 73 * ktime_get_boottime - Returns monotonic time since boot in ktime_t format
70 * 74 *
@@ -76,6 +80,11 @@ static inline ktime_t ktime_get_boottime(void)
76 return ktime_get_with_offset(TK_OFFS_BOOT); 80 return ktime_get_with_offset(TK_OFFS_BOOT);
77} 81}
78 82
83static inline ktime_t ktime_get_coarse_boottime(void)
84{
85 return ktime_get_coarse_with_offset(TK_OFFS_BOOT);
86}
87
79/** 88/**
80 * ktime_get_clocktai - Returns the TAI time of day in ktime_t format 89 * ktime_get_clocktai - Returns the TAI time of day in ktime_t format
81 */ 90 */
@@ -84,6 +93,11 @@ static inline ktime_t ktime_get_clocktai(void)
84 return ktime_get_with_offset(TK_OFFS_TAI); 93 return ktime_get_with_offset(TK_OFFS_TAI);
85} 94}
86 95
96static inline ktime_t ktime_get_coarse_clocktai(void)
97{
98 return ktime_get_coarse_with_offset(TK_OFFS_TAI);
99}
100
87/** 101/**
88 * ktime_mono_to_real - Convert monotonic time to clock realtime 102 * ktime_mono_to_real - Convert monotonic time to clock realtime
89 */ 103 */
@@ -123,18 +137,40 @@ extern u64 ktime_get_boot_fast_ns(void);
123extern u64 ktime_get_real_fast_ns(void); 137extern u64 ktime_get_real_fast_ns(void);
124 138
125/* 139/*
126 * timespec64 interfaces utilizing the ktime based ones 140 * timespec64/time64_t interfaces utilizing the ktime based ones
141 * for API completeness, these could be implemented more efficiently
142 * if needed.
127 */ 143 */
128static inline void get_monotonic_boottime64(struct timespec64 *ts) 144static inline void ktime_get_boottime_ts64(struct timespec64 *ts)
129{ 145{
130 *ts = ktime_to_timespec64(ktime_get_boottime()); 146 *ts = ktime_to_timespec64(ktime_get_boottime());
131} 147}
132 148
133static inline void timekeeping_clocktai64(struct timespec64 *ts) 149static inline void ktime_get_coarse_boottime_ts64(struct timespec64 *ts)
150{
151 *ts = ktime_to_timespec64(ktime_get_coarse_boottime());
152}
153
154static inline time64_t ktime_get_boottime_seconds(void)
155{
156 return ktime_divns(ktime_get_coarse_boottime(), NSEC_PER_SEC);
157}
158
159static inline void ktime_get_clocktai_ts64(struct timespec64 *ts)
134{ 160{
135 *ts = ktime_to_timespec64(ktime_get_clocktai()); 161 *ts = ktime_to_timespec64(ktime_get_clocktai());
136} 162}
137 163
164static inline void ktime_get_coarse_clocktai_ts64(struct timespec64 *ts)
165{
166 *ts = ktime_to_timespec64(ktime_get_coarse_clocktai());
167}
168
169static inline time64_t ktime_get_clocktai_seconds(void)
170{
171 return ktime_divns(ktime_get_coarse_clocktai(), NSEC_PER_SEC);
172}
173
138/* 174/*
139 * RTC specific 175 * RTC specific
140 */ 176 */
@@ -210,5 +246,30 @@ extern void read_persistent_clock64(struct timespec64 *ts);
210extern void read_boot_clock64(struct timespec64 *ts); 246extern void read_boot_clock64(struct timespec64 *ts);
211extern int update_persistent_clock64(struct timespec64 now); 247extern int update_persistent_clock64(struct timespec64 now);
212 248
249/*
250 * deprecated aliases, don't use in new code
251 */
252#define getnstimeofday64(ts) ktime_get_real_ts64(ts)
253#define get_monotonic_boottime64(ts) ktime_get_boottime_ts64(ts)
254#define getrawmonotonic64(ts) ktime_get_raw_ts64(ts)
255#define timekeeping_clocktai64(ts) ktime_get_clocktai_ts64(ts)
256
257static inline struct timespec64 current_kernel_time64(void)
258{
259 struct timespec64 ts;
260
261 ktime_get_coarse_real_ts64(&ts);
262
263 return ts;
264}
265
266static inline struct timespec64 get_monotonic_coarse64(void)
267{
268 struct timespec64 ts;
269
270 ktime_get_coarse_ts64(&ts);
271
272 return ts;
273}
213 274
214#endif 275#endif
diff --git a/include/linux/timekeeping32.h b/include/linux/timekeeping32.h
index 3616b4becb59..8762c2f45f8b 100644
--- a/include/linux/timekeeping32.h
+++ b/include/linux/timekeeping32.h
@@ -11,55 +11,13 @@ unsigned long get_seconds(void);
11 11
12static inline struct timespec current_kernel_time(void) 12static inline struct timespec current_kernel_time(void)
13{ 13{
14 struct timespec64 now = current_kernel_time64(); 14 struct timespec64 ts64;
15
16 return timespec64_to_timespec(now);
17}
18
19#if BITS_PER_LONG == 64
20/**
21 * Deprecated. Use do_settimeofday64().
22 */
23static inline int do_settimeofday(const struct timespec *ts)
24{
25 return do_settimeofday64(ts);
26}
27
28static inline int __getnstimeofday(struct timespec *ts)
29{
30 return __getnstimeofday64(ts);
31}
32
33static inline void getnstimeofday(struct timespec *ts)
34{
35 getnstimeofday64(ts);
36}
37
38static inline void ktime_get_ts(struct timespec *ts)
39{
40 ktime_get_ts64(ts);
41}
42
43static inline void ktime_get_real_ts(struct timespec *ts)
44{
45 getnstimeofday64(ts);
46}
47 15
48static inline void getrawmonotonic(struct timespec *ts) 16 ktime_get_coarse_real_ts64(&ts64);
49{
50 getrawmonotonic64(ts);
51}
52 17
53static inline struct timespec get_monotonic_coarse(void) 18 return timespec64_to_timespec(ts64);
54{
55 return get_monotonic_coarse64();
56} 19}
57 20
58static inline void getboottime(struct timespec *ts)
59{
60 return getboottime64(ts);
61}
62#else
63/** 21/**
64 * Deprecated. Use do_settimeofday64(). 22 * Deprecated. Use do_settimeofday64().
65 */ 23 */
@@ -71,20 +29,11 @@ static inline int do_settimeofday(const struct timespec *ts)
71 return do_settimeofday64(&ts64); 29 return do_settimeofday64(&ts64);
72} 30}
73 31
74static inline int __getnstimeofday(struct timespec *ts)
75{
76 struct timespec64 ts64;
77 int ret = __getnstimeofday64(&ts64);
78
79 *ts = timespec64_to_timespec(ts64);
80 return ret;
81}
82
83static inline void getnstimeofday(struct timespec *ts) 32static inline void getnstimeofday(struct timespec *ts)
84{ 33{
85 struct timespec64 ts64; 34 struct timespec64 ts64;
86 35
87 getnstimeofday64(&ts64); 36 ktime_get_real_ts64(&ts64);
88 *ts = timespec64_to_timespec(ts64); 37 *ts = timespec64_to_timespec(ts64);
89} 38}
90 39
@@ -100,7 +49,7 @@ static inline void ktime_get_real_ts(struct timespec *ts)
100{ 49{
101 struct timespec64 ts64; 50 struct timespec64 ts64;
102 51
103 getnstimeofday64(&ts64); 52 ktime_get_real_ts64(&ts64);
104 *ts = timespec64_to_timespec(ts64); 53 *ts = timespec64_to_timespec(ts64);
105} 54}
106 55
@@ -108,13 +57,17 @@ static inline void getrawmonotonic(struct timespec *ts)
108{ 57{
109 struct timespec64 ts64; 58 struct timespec64 ts64;
110 59
111 getrawmonotonic64(&ts64); 60 ktime_get_raw_ts64(&ts64);
112 *ts = timespec64_to_timespec(ts64); 61 *ts = timespec64_to_timespec(ts64);
113} 62}
114 63
115static inline struct timespec get_monotonic_coarse(void) 64static inline struct timespec get_monotonic_coarse(void)
116{ 65{
117 return timespec64_to_timespec(get_monotonic_coarse64()); 66 struct timespec64 ts64;
67
68 ktime_get_coarse_ts64(&ts64);
69
70 return timespec64_to_timespec(ts64);
118} 71}
119 72
120static inline void getboottime(struct timespec *ts) 73static inline void getboottime(struct timespec *ts)
@@ -124,7 +77,6 @@ static inline void getboottime(struct timespec *ts)
124 getboottime64(&ts64); 77 getboottime64(&ts64);
125 *ts = timespec64_to_timespec(ts64); 78 *ts = timespec64_to_timespec(ts64);
126} 79}
127#endif
128 80
129/* 81/*
130 * Timespec interfaces utilizing the ktime based ones 82 * Timespec interfaces utilizing the ktime based ones
diff --git a/include/uapi/asm-generic/msgbuf.h b/include/uapi/asm-generic/msgbuf.h
index fb306ebdb36f..9fe4881557cb 100644
--- a/include/uapi/asm-generic/msgbuf.h
+++ b/include/uapi/asm-generic/msgbuf.h
@@ -18,31 +18,30 @@
18 * On big-endian systems, the padding is in the wrong place. 18 * On big-endian systems, the padding is in the wrong place.
19 * 19 *
20 * Pad space is left for: 20 * Pad space is left for:
21 * - 64-bit time_t to solve y2038 problem
22 * - 2 miscellaneous 32-bit values 21 * - 2 miscellaneous 32-bit values
23 */ 22 */
24 23
25struct msqid64_ds { 24struct msqid64_ds {
26 struct ipc64_perm msg_perm; 25 struct ipc64_perm msg_perm;
26#if __BITS_PER_LONG == 64
27 __kernel_time_t msg_stime; /* last msgsnd time */ 27 __kernel_time_t msg_stime; /* last msgsnd time */
28#if __BITS_PER_LONG != 64
29 unsigned long __unused1;
30#endif
31 __kernel_time_t msg_rtime; /* last msgrcv time */ 28 __kernel_time_t msg_rtime; /* last msgrcv time */
32#if __BITS_PER_LONG != 64
33 unsigned long __unused2;
34#endif
35 __kernel_time_t msg_ctime; /* last change time */ 29 __kernel_time_t msg_ctime; /* last change time */
36#if __BITS_PER_LONG != 64 30#else
37 unsigned long __unused3; 31 unsigned long msg_stime; /* last msgsnd time */
32 unsigned long msg_stime_high;
33 unsigned long msg_rtime; /* last msgrcv time */
34 unsigned long msg_rtime_high;
35 unsigned long msg_ctime; /* last change time */
36 unsigned long msg_ctime_high;
38#endif 37#endif
39 __kernel_ulong_t msg_cbytes; /* current number of bytes on queue */ 38 unsigned long msg_cbytes; /* current number of bytes on queue */
40 __kernel_ulong_t msg_qnum; /* number of messages in queue */ 39 unsigned long msg_qnum; /* number of messages in queue */
41 __kernel_ulong_t msg_qbytes; /* max number of bytes on queue */ 40 unsigned long msg_qbytes; /* max number of bytes on queue */
42 __kernel_pid_t msg_lspid; /* pid of last msgsnd */ 41 __kernel_pid_t msg_lspid; /* pid of last msgsnd */
43 __kernel_pid_t msg_lrpid; /* last receive pid */ 42 __kernel_pid_t msg_lrpid; /* last receive pid */
44 __kernel_ulong_t __unused4; 43 unsigned long __unused4;
45 __kernel_ulong_t __unused5; 44 unsigned long __unused5;
46}; 45};
47 46
48#endif /* __ASM_GENERIC_MSGBUF_H */ 47#endif /* __ASM_GENERIC_MSGBUF_H */
diff --git a/include/uapi/asm-generic/sembuf.h b/include/uapi/asm-generic/sembuf.h
index cbf9cfe977d6..0bae010f1b64 100644
--- a/include/uapi/asm-generic/sembuf.h
+++ b/include/uapi/asm-generic/sembuf.h
@@ -13,23 +13,29 @@
13 * everyone just ended up making identical copies without specific 13 * everyone just ended up making identical copies without specific
14 * optimizations, so we may just as well all use the same one. 14 * optimizations, so we may just as well all use the same one.
15 * 15 *
16 * 64 bit architectures typically define a 64 bit __kernel_time_t, 16 * 64 bit architectures use a 64-bit __kernel_time_t here, while
17 * 32 bit architectures have a pair of unsigned long values.
17 * so they do not need the first two padding words. 18 * so they do not need the first two padding words.
18 * On big-endian systems, the padding is in the wrong place.
19 * 19 *
20 * Pad space is left for: 20 * On big-endian systems, the padding is in the wrong place for
21 * - 64-bit time_t to solve y2038 problem 21 * historic reasons, so user space has to reconstruct a time_t
22 * - 2 miscellaneous 32-bit values 22 * value using
23 *
24 * user_semid_ds.sem_otime = kernel_semid64_ds.sem_otime +
25 * ((long long)kernel_semid64_ds.sem_otime_high << 32)
26 *
27 * Pad space is left for 2 miscellaneous 32-bit values
23 */ 28 */
24struct semid64_ds { 29struct semid64_ds {
25 struct ipc64_perm sem_perm; /* permissions .. see ipc.h */ 30 struct ipc64_perm sem_perm; /* permissions .. see ipc.h */
31#if __BITS_PER_LONG == 64
26 __kernel_time_t sem_otime; /* last semop time */ 32 __kernel_time_t sem_otime; /* last semop time */
27#if __BITS_PER_LONG != 64
28 unsigned long __unused1;
29#endif
30 __kernel_time_t sem_ctime; /* last change time */ 33 __kernel_time_t sem_ctime; /* last change time */
31#if __BITS_PER_LONG != 64 34#else
32 unsigned long __unused2; 35 unsigned long sem_otime; /* last semop time */
36 unsigned long sem_otime_high;
37 unsigned long sem_ctime; /* last change time */
38 unsigned long sem_ctime_high;
33#endif 39#endif
34 unsigned long sem_nsems; /* no. of semaphores in array */ 40 unsigned long sem_nsems; /* no. of semaphores in array */
35 unsigned long __unused3; 41 unsigned long __unused3;
diff --git a/include/uapi/asm-generic/shmbuf.h b/include/uapi/asm-generic/shmbuf.h
index 2b6c3bb97f97..e504422fc501 100644
--- a/include/uapi/asm-generic/shmbuf.h
+++ b/include/uapi/asm-generic/shmbuf.h
@@ -19,42 +19,41 @@
19 * 19 *
20 * 20 *
21 * Pad space is left for: 21 * Pad space is left for:
22 * - 64-bit time_t to solve y2038 problem
23 * - 2 miscellaneous 32-bit values 22 * - 2 miscellaneous 32-bit values
24 */ 23 */
25 24
26struct shmid64_ds { 25struct shmid64_ds {
27 struct ipc64_perm shm_perm; /* operation perms */ 26 struct ipc64_perm shm_perm; /* operation perms */
28 size_t shm_segsz; /* size of segment (bytes) */ 27 size_t shm_segsz; /* size of segment (bytes) */
28#if __BITS_PER_LONG == 64
29 __kernel_time_t shm_atime; /* last attach time */ 29 __kernel_time_t shm_atime; /* last attach time */
30#if __BITS_PER_LONG != 64
31 unsigned long __unused1;
32#endif
33 __kernel_time_t shm_dtime; /* last detach time */ 30 __kernel_time_t shm_dtime; /* last detach time */
34#if __BITS_PER_LONG != 64
35 unsigned long __unused2;
36#endif
37 __kernel_time_t shm_ctime; /* last change time */ 31 __kernel_time_t shm_ctime; /* last change time */
38#if __BITS_PER_LONG != 64 32#else
39 unsigned long __unused3; 33 unsigned long shm_atime; /* last attach time */
34 unsigned long shm_atime_high;
35 unsigned long shm_dtime; /* last detach time */
36 unsigned long shm_dtime_high;
37 unsigned long shm_ctime; /* last change time */
38 unsigned long shm_ctime_high;
40#endif 39#endif
41 __kernel_pid_t shm_cpid; /* pid of creator */ 40 __kernel_pid_t shm_cpid; /* pid of creator */
42 __kernel_pid_t shm_lpid; /* pid of last operator */ 41 __kernel_pid_t shm_lpid; /* pid of last operator */
43 __kernel_ulong_t shm_nattch; /* no. of current attaches */ 42 unsigned long shm_nattch; /* no. of current attaches */
44 __kernel_ulong_t __unused4; 43 unsigned long __unused4;
45 __kernel_ulong_t __unused5; 44 unsigned long __unused5;
46}; 45};
47 46
48struct shminfo64 { 47struct shminfo64 {
49 __kernel_ulong_t shmmax; 48 unsigned long shmmax;
50 __kernel_ulong_t shmmin; 49 unsigned long shmmin;
51 __kernel_ulong_t shmmni; 50 unsigned long shmmni;
52 __kernel_ulong_t shmseg; 51 unsigned long shmseg;
53 __kernel_ulong_t shmall; 52 unsigned long shmall;
54 __kernel_ulong_t __unused1; 53 unsigned long __unused1;
55 __kernel_ulong_t __unused2; 54 unsigned long __unused2;
56 __kernel_ulong_t __unused3; 55 unsigned long __unused3;
57 __kernel_ulong_t __unused4; 56 unsigned long __unused4;
58}; 57};
59 58
60#endif /* __ASM_GENERIC_SHMBUF_H */ 59#endif /* __ASM_GENERIC_SHMBUF_H */
diff --git a/ipc/mqueue.c b/ipc/mqueue.c
index a808f29d4c5a..c0d58f390c3b 100644
--- a/ipc/mqueue.c
+++ b/ipc/mqueue.c
@@ -691,7 +691,7 @@ static void __do_notify(struct mqueue_inode_info *info)
691 wake_up(&info->wait_q); 691 wake_up(&info->wait_q);
692} 692}
693 693
694static int prepare_timeout(const struct timespec __user *u_abs_timeout, 694static int prepare_timeout(const struct __kernel_timespec __user *u_abs_timeout,
695 struct timespec64 *ts) 695 struct timespec64 *ts)
696{ 696{
697 if (get_timespec64(ts, u_abs_timeout)) 697 if (get_timespec64(ts, u_abs_timeout))
@@ -1128,7 +1128,7 @@ out:
1128 1128
1129SYSCALL_DEFINE5(mq_timedsend, mqd_t, mqdes, const char __user *, u_msg_ptr, 1129SYSCALL_DEFINE5(mq_timedsend, mqd_t, mqdes, const char __user *, u_msg_ptr,
1130 size_t, msg_len, unsigned int, msg_prio, 1130 size_t, msg_len, unsigned int, msg_prio,
1131 const struct timespec __user *, u_abs_timeout) 1131 const struct __kernel_timespec __user *, u_abs_timeout)
1132{ 1132{
1133 struct timespec64 ts, *p = NULL; 1133 struct timespec64 ts, *p = NULL;
1134 if (u_abs_timeout) { 1134 if (u_abs_timeout) {
@@ -1142,7 +1142,7 @@ SYSCALL_DEFINE5(mq_timedsend, mqd_t, mqdes, const char __user *, u_msg_ptr,
1142 1142
1143SYSCALL_DEFINE5(mq_timedreceive, mqd_t, mqdes, char __user *, u_msg_ptr, 1143SYSCALL_DEFINE5(mq_timedreceive, mqd_t, mqdes, char __user *, u_msg_ptr,
1144 size_t, msg_len, unsigned int __user *, u_msg_prio, 1144 size_t, msg_len, unsigned int __user *, u_msg_prio,
1145 const struct timespec __user *, u_abs_timeout) 1145 const struct __kernel_timespec __user *, u_abs_timeout)
1146{ 1146{
1147 struct timespec64 ts, *p = NULL; 1147 struct timespec64 ts, *p = NULL;
1148 if (u_abs_timeout) { 1148 if (u_abs_timeout) {
@@ -1420,6 +1420,47 @@ COMPAT_SYSCALL_DEFINE4(mq_open, const char __user *, u_name,
1420 return do_mq_open(u_name, oflag, mode, p); 1420 return do_mq_open(u_name, oflag, mode, p);
1421} 1421}
1422 1422
1423COMPAT_SYSCALL_DEFINE2(mq_notify, mqd_t, mqdes,
1424 const struct compat_sigevent __user *, u_notification)
1425{
1426 struct sigevent n, *p = NULL;
1427 if (u_notification) {
1428 if (get_compat_sigevent(&n, u_notification))
1429 return -EFAULT;
1430 if (n.sigev_notify == SIGEV_THREAD)
1431 n.sigev_value.sival_ptr = compat_ptr(n.sigev_value.sival_int);
1432 p = &n;
1433 }
1434 return do_mq_notify(mqdes, p);
1435}
1436
1437COMPAT_SYSCALL_DEFINE3(mq_getsetattr, mqd_t, mqdes,
1438 const struct compat_mq_attr __user *, u_mqstat,
1439 struct compat_mq_attr __user *, u_omqstat)
1440{
1441 int ret;
1442 struct mq_attr mqstat, omqstat;
1443 struct mq_attr *new = NULL, *old = NULL;
1444
1445 if (u_mqstat) {
1446 new = &mqstat;
1447 if (get_compat_mq_attr(new, u_mqstat))
1448 return -EFAULT;
1449 }
1450 if (u_omqstat)
1451 old = &omqstat;
1452
1453 ret = do_mq_getsetattr(mqdes, new, old);
1454 if (ret || !old)
1455 return ret;
1456
1457 if (put_compat_mq_attr(old, u_omqstat))
1458 return -EFAULT;
1459 return 0;
1460}
1461#endif
1462
1463#ifdef CONFIG_COMPAT_32BIT_TIME
1423static int compat_prepare_timeout(const struct compat_timespec __user *p, 1464static int compat_prepare_timeout(const struct compat_timespec __user *p,
1424 struct timespec64 *ts) 1465 struct timespec64 *ts)
1425{ 1466{
@@ -1459,45 +1500,6 @@ COMPAT_SYSCALL_DEFINE5(mq_timedreceive, mqd_t, mqdes,
1459 } 1500 }
1460 return do_mq_timedreceive(mqdes, u_msg_ptr, msg_len, u_msg_prio, p); 1501 return do_mq_timedreceive(mqdes, u_msg_ptr, msg_len, u_msg_prio, p);
1461} 1502}
1462
1463COMPAT_SYSCALL_DEFINE2(mq_notify, mqd_t, mqdes,
1464 const struct compat_sigevent __user *, u_notification)
1465{
1466 struct sigevent n, *p = NULL;
1467 if (u_notification) {
1468 if (get_compat_sigevent(&n, u_notification))
1469 return -EFAULT;
1470 if (n.sigev_notify == SIGEV_THREAD)
1471 n.sigev_value.sival_ptr = compat_ptr(n.sigev_value.sival_int);
1472 p = &n;
1473 }
1474 return do_mq_notify(mqdes, p);
1475}
1476
1477COMPAT_SYSCALL_DEFINE3(mq_getsetattr, mqd_t, mqdes,
1478 const struct compat_mq_attr __user *, u_mqstat,
1479 struct compat_mq_attr __user *, u_omqstat)
1480{
1481 int ret;
1482 struct mq_attr mqstat, omqstat;
1483 struct mq_attr *new = NULL, *old = NULL;
1484
1485 if (u_mqstat) {
1486 new = &mqstat;
1487 if (get_compat_mq_attr(new, u_mqstat))
1488 return -EFAULT;
1489 }
1490 if (u_omqstat)
1491 old = &omqstat;
1492
1493 ret = do_mq_getsetattr(mqdes, new, old);
1494 if (ret || !old)
1495 return ret;
1496
1497 if (put_compat_mq_attr(old, u_omqstat))
1498 return -EFAULT;
1499 return 0;
1500}
1501#endif 1503#endif
1502 1504
1503static const struct inode_operations mqueue_dir_inode_operations = { 1505static const struct inode_operations mqueue_dir_inode_operations = {
diff --git a/ipc/msg.c b/ipc/msg.c
index 56fd1c73eedc..3b6545302598 100644
--- a/ipc/msg.c
+++ b/ipc/msg.c
@@ -537,6 +537,11 @@ static int msgctl_stat(struct ipc_namespace *ns, int msqid,
537 p->msg_stime = msq->q_stime; 537 p->msg_stime = msq->q_stime;
538 p->msg_rtime = msq->q_rtime; 538 p->msg_rtime = msq->q_rtime;
539 p->msg_ctime = msq->q_ctime; 539 p->msg_ctime = msq->q_ctime;
540#ifndef CONFIG_64BIT
541 p->msg_stime_high = msq->q_stime >> 32;
542 p->msg_rtime_high = msq->q_rtime >> 32;
543 p->msg_ctime_high = msq->q_ctime >> 32;
544#endif
540 p->msg_cbytes = msq->q_cbytes; 545 p->msg_cbytes = msq->q_cbytes;
541 p->msg_qnum = msq->q_qnum; 546 p->msg_qnum = msq->q_qnum;
542 p->msg_qbytes = msq->q_qbytes; 547 p->msg_qbytes = msq->q_qbytes;
@@ -646,9 +651,12 @@ static int copy_compat_msqid_to_user(void __user *buf, struct msqid64_ds *in,
646 struct compat_msqid64_ds v; 651 struct compat_msqid64_ds v;
647 memset(&v, 0, sizeof(v)); 652 memset(&v, 0, sizeof(v));
648 to_compat_ipc64_perm(&v.msg_perm, &in->msg_perm); 653 to_compat_ipc64_perm(&v.msg_perm, &in->msg_perm);
649 v.msg_stime = in->msg_stime; 654 v.msg_stime = lower_32_bits(in->msg_stime);
650 v.msg_rtime = in->msg_rtime; 655 v.msg_stime_high = upper_32_bits(in->msg_stime);
651 v.msg_ctime = in->msg_ctime; 656 v.msg_rtime = lower_32_bits(in->msg_rtime);
657 v.msg_rtime_high = upper_32_bits(in->msg_rtime);
658 v.msg_ctime = lower_32_bits(in->msg_ctime);
659 v.msg_ctime_high = upper_32_bits(in->msg_ctime);
652 v.msg_cbytes = in->msg_cbytes; 660 v.msg_cbytes = in->msg_cbytes;
653 v.msg_qnum = in->msg_qnum; 661 v.msg_qnum = in->msg_qnum;
654 v.msg_qbytes = in->msg_qbytes; 662 v.msg_qbytes = in->msg_qbytes;
@@ -758,7 +766,7 @@ static inline int pipelined_send(struct msg_queue *msq, struct msg_msg *msg,
758 WRITE_ONCE(msr->r_msg, ERR_PTR(-E2BIG)); 766 WRITE_ONCE(msr->r_msg, ERR_PTR(-E2BIG));
759 } else { 767 } else {
760 ipc_update_pid(&msq->q_lrpid, task_pid(msr->r_tsk)); 768 ipc_update_pid(&msq->q_lrpid, task_pid(msr->r_tsk));
761 msq->q_rtime = get_seconds(); 769 msq->q_rtime = ktime_get_real_seconds();
762 770
763 wake_q_add(wake_q, msr->r_tsk); 771 wake_q_add(wake_q, msr->r_tsk);
764 WRITE_ONCE(msr->r_msg, msg); 772 WRITE_ONCE(msr->r_msg, msg);
@@ -859,7 +867,7 @@ static long do_msgsnd(int msqid, long mtype, void __user *mtext,
859 } 867 }
860 868
861 ipc_update_pid(&msq->q_lspid, task_tgid(current)); 869 ipc_update_pid(&msq->q_lspid, task_tgid(current));
862 msq->q_stime = get_seconds(); 870 msq->q_stime = ktime_get_real_seconds();
863 871
864 if (!pipelined_send(msq, msg, &wake_q)) { 872 if (!pipelined_send(msq, msg, &wake_q)) {
865 /* no one is waiting for this message, enqueue it */ 873 /* no one is waiting for this message, enqueue it */
@@ -1087,7 +1095,7 @@ static long do_msgrcv(int msqid, void __user *buf, size_t bufsz, long msgtyp, in
1087 1095
1088 list_del(&msg->m_list); 1096 list_del(&msg->m_list);
1089 msq->q_qnum--; 1097 msq->q_qnum--;
1090 msq->q_rtime = get_seconds(); 1098 msq->q_rtime = ktime_get_real_seconds();
1091 ipc_update_pid(&msq->q_lrpid, task_tgid(current)); 1099 ipc_update_pid(&msq->q_lrpid, task_tgid(current));
1092 msq->q_cbytes -= msg->m_ts; 1100 msq->q_cbytes -= msg->m_ts;
1093 atomic_sub(msg->m_ts, &ns->msg_bytes); 1101 atomic_sub(msg->m_ts, &ns->msg_bytes);
diff --git a/ipc/sem.c b/ipc/sem.c
index 06be75d9217a..cfd94d48a9aa 100644
--- a/ipc/sem.c
+++ b/ipc/sem.c
@@ -70,6 +70,7 @@
70 * The worst-case behavior is nevertheless O(N^2) for N wakeups. 70 * The worst-case behavior is nevertheless O(N^2) for N wakeups.
71 */ 71 */
72 72
73#include <linux/compat.h>
73#include <linux/slab.h> 74#include <linux/slab.h>
74#include <linux/spinlock.h> 75#include <linux/spinlock.h>
75#include <linux/init.h> 76#include <linux/init.h>
@@ -104,7 +105,7 @@ struct sem {
104 /* that alter the semaphore */ 105 /* that alter the semaphore */
105 struct list_head pending_const; /* pending single-sop operations */ 106 struct list_head pending_const; /* pending single-sop operations */
106 /* that do not alter the semaphore*/ 107 /* that do not alter the semaphore*/
107 time_t sem_otime; /* candidate for sem_otime */ 108 time64_t sem_otime; /* candidate for sem_otime */
108} ____cacheline_aligned_in_smp; 109} ____cacheline_aligned_in_smp;
109 110
110/* One sem_array data structure for each set of semaphores in the system. */ 111/* One sem_array data structure for each set of semaphores in the system. */
@@ -984,10 +985,10 @@ again:
984static void set_semotime(struct sem_array *sma, struct sembuf *sops) 985static void set_semotime(struct sem_array *sma, struct sembuf *sops)
985{ 986{
986 if (sops == NULL) { 987 if (sops == NULL) {
987 sma->sems[0].sem_otime = get_seconds(); 988 sma->sems[0].sem_otime = ktime_get_real_seconds();
988 } else { 989 } else {
989 sma->sems[sops[0].sem_num].sem_otime = 990 sma->sems[sops[0].sem_num].sem_otime =
990 get_seconds(); 991 ktime_get_real_seconds();
991 } 992 }
992} 993}
993 994
@@ -1214,6 +1215,7 @@ static int semctl_stat(struct ipc_namespace *ns, int semid,
1214 int cmd, struct semid64_ds *semid64) 1215 int cmd, struct semid64_ds *semid64)
1215{ 1216{
1216 struct sem_array *sma; 1217 struct sem_array *sma;
1218 time64_t semotime;
1217 int id = 0; 1219 int id = 0;
1218 int err; 1220 int err;
1219 1221
@@ -1257,8 +1259,13 @@ static int semctl_stat(struct ipc_namespace *ns, int semid,
1257 } 1259 }
1258 1260
1259 kernel_to_ipc64_perm(&sma->sem_perm, &semid64->sem_perm); 1261 kernel_to_ipc64_perm(&sma->sem_perm, &semid64->sem_perm);
1260 semid64->sem_otime = get_semotime(sma); 1262 semotime = get_semotime(sma);
1263 semid64->sem_otime = semotime;
1261 semid64->sem_ctime = sma->sem_ctime; 1264 semid64->sem_ctime = sma->sem_ctime;
1265#ifndef CONFIG_64BIT
1266 semid64->sem_otime_high = semotime >> 32;
1267 semid64->sem_ctime_high = sma->sem_ctime >> 32;
1268#endif
1262 semid64->sem_nsems = sma->sem_nsems; 1269 semid64->sem_nsems = sma->sem_nsems;
1263 1270
1264 ipc_unlock_object(&sma->sem_perm); 1271 ipc_unlock_object(&sma->sem_perm);
@@ -1704,8 +1711,10 @@ static int copy_compat_semid_to_user(void __user *buf, struct semid64_ds *in,
1704 struct compat_semid64_ds v; 1711 struct compat_semid64_ds v;
1705 memset(&v, 0, sizeof(v)); 1712 memset(&v, 0, sizeof(v));
1706 to_compat_ipc64_perm(&v.sem_perm, &in->sem_perm); 1713 to_compat_ipc64_perm(&v.sem_perm, &in->sem_perm);
1707 v.sem_otime = in->sem_otime; 1714 v.sem_otime = lower_32_bits(in->sem_otime);
1708 v.sem_ctime = in->sem_ctime; 1715 v.sem_otime_high = upper_32_bits(in->sem_otime);
1716 v.sem_ctime = lower_32_bits(in->sem_ctime);
1717 v.sem_ctime_high = upper_32_bits(in->sem_ctime);
1709 v.sem_nsems = in->sem_nsems; 1718 v.sem_nsems = in->sem_nsems;
1710 return copy_to_user(buf, &v, sizeof(v)); 1719 return copy_to_user(buf, &v, sizeof(v));
1711 } else { 1720 } else {
@@ -2168,7 +2177,7 @@ out_free:
2168} 2177}
2169 2178
2170long ksys_semtimedop(int semid, struct sembuf __user *tsops, 2179long ksys_semtimedop(int semid, struct sembuf __user *tsops,
2171 unsigned int nsops, const struct timespec __user *timeout) 2180 unsigned int nsops, const struct __kernel_timespec __user *timeout)
2172{ 2181{
2173 if (timeout) { 2182 if (timeout) {
2174 struct timespec64 ts; 2183 struct timespec64 ts;
@@ -2180,12 +2189,12 @@ long ksys_semtimedop(int semid, struct sembuf __user *tsops,
2180} 2189}
2181 2190
2182SYSCALL_DEFINE4(semtimedop, int, semid, struct sembuf __user *, tsops, 2191SYSCALL_DEFINE4(semtimedop, int, semid, struct sembuf __user *, tsops,
2183 unsigned int, nsops, const struct timespec __user *, timeout) 2192 unsigned int, nsops, const struct __kernel_timespec __user *, timeout)
2184{ 2193{
2185 return ksys_semtimedop(semid, tsops, nsops, timeout); 2194 return ksys_semtimedop(semid, tsops, nsops, timeout);
2186} 2195}
2187 2196
2188#ifdef CONFIG_COMPAT 2197#ifdef CONFIG_COMPAT_32BIT_TIME
2189long compat_ksys_semtimedop(int semid, struct sembuf __user *tsems, 2198long compat_ksys_semtimedop(int semid, struct sembuf __user *tsems,
2190 unsigned int nsops, 2199 unsigned int nsops,
2191 const struct compat_timespec __user *timeout) 2200 const struct compat_timespec __user *timeout)
diff --git a/ipc/shm.c b/ipc/shm.c
index d73269381ec7..29978ee76c2e 100644
--- a/ipc/shm.c
+++ b/ipc/shm.c
@@ -1002,6 +1002,11 @@ static int shmctl_stat(struct ipc_namespace *ns, int shmid,
1002 tbuf->shm_atime = shp->shm_atim; 1002 tbuf->shm_atime = shp->shm_atim;
1003 tbuf->shm_dtime = shp->shm_dtim; 1003 tbuf->shm_dtime = shp->shm_dtim;
1004 tbuf->shm_ctime = shp->shm_ctim; 1004 tbuf->shm_ctime = shp->shm_ctim;
1005#ifndef CONFIG_64BIT
1006 tbuf->shm_atime_high = shp->shm_atim >> 32;
1007 tbuf->shm_dtime_high = shp->shm_dtim >> 32;
1008 tbuf->shm_ctime_high = shp->shm_ctim >> 32;
1009#endif
1005 tbuf->shm_cpid = pid_vnr(shp->shm_cprid); 1010 tbuf->shm_cpid = pid_vnr(shp->shm_cprid);
1006 tbuf->shm_lpid = pid_vnr(shp->shm_lprid); 1011 tbuf->shm_lpid = pid_vnr(shp->shm_lprid);
1007 tbuf->shm_nattch = shp->shm_nattch; 1012 tbuf->shm_nattch = shp->shm_nattch;
@@ -1233,9 +1238,12 @@ static int copy_compat_shmid_to_user(void __user *buf, struct shmid64_ds *in,
1233 struct compat_shmid64_ds v; 1238 struct compat_shmid64_ds v;
1234 memset(&v, 0, sizeof(v)); 1239 memset(&v, 0, sizeof(v));
1235 to_compat_ipc64_perm(&v.shm_perm, &in->shm_perm); 1240 to_compat_ipc64_perm(&v.shm_perm, &in->shm_perm);
1236 v.shm_atime = in->shm_atime; 1241 v.shm_atime = lower_32_bits(in->shm_atime);
1237 v.shm_dtime = in->shm_dtime; 1242 v.shm_atime_high = upper_32_bits(in->shm_atime);
1238 v.shm_ctime = in->shm_ctime; 1243 v.shm_dtime = lower_32_bits(in->shm_dtime);
1244 v.shm_dtime_high = upper_32_bits(in->shm_dtime);
1245 v.shm_ctime = lower_32_bits(in->shm_ctime);
1246 v.shm_ctime_high = upper_32_bits(in->shm_ctime);
1239 v.shm_segsz = in->shm_segsz; 1247 v.shm_segsz = in->shm_segsz;
1240 v.shm_nattch = in->shm_nattch; 1248 v.shm_nattch = in->shm_nattch;
1241 v.shm_cpid = in->shm_cpid; 1249 v.shm_cpid = in->shm_cpid;
diff --git a/ipc/syscall.c b/ipc/syscall.c
index 77a883ef2eca..65d405f1ba0c 100644
--- a/ipc/syscall.c
+++ b/ipc/syscall.c
@@ -30,9 +30,14 @@ SYSCALL_DEFINE6(ipc, unsigned int, call, int, first, unsigned long, second,
30 return ksys_semtimedop(first, (struct sembuf __user *)ptr, 30 return ksys_semtimedop(first, (struct sembuf __user *)ptr,
31 second, NULL); 31 second, NULL);
32 case SEMTIMEDOP: 32 case SEMTIMEDOP:
33 return ksys_semtimedop(first, (struct sembuf __user *)ptr, 33 if (IS_ENABLED(CONFIG_64BIT) || !IS_ENABLED(CONFIG_64BIT_TIME))
34 second, 34 return ksys_semtimedop(first, ptr, second,
35 (const struct timespec __user *)fifth); 35 (const struct __kernel_timespec __user *)fifth);
36 else if (IS_ENABLED(CONFIG_COMPAT_32BIT_TIME))
37 return compat_ksys_semtimedop(first, ptr, second,
38 (const struct compat_timespec __user *)fifth);
39 else
40 return -ENOSYS;
36 41
37 case SEMGET: 42 case SEMGET:
38 return ksys_semget(first, second, third); 43 return ksys_semget(first, second, third);
@@ -130,6 +135,8 @@ COMPAT_SYSCALL_DEFINE6(ipc, u32, call, int, first, int, second,
130 /* struct sembuf is the same on 32 and 64bit :)) */ 135 /* struct sembuf is the same on 32 and 64bit :)) */
131 return ksys_semtimedop(first, compat_ptr(ptr), second, NULL); 136 return ksys_semtimedop(first, compat_ptr(ptr), second, NULL);
132 case SEMTIMEDOP: 137 case SEMTIMEDOP:
138 if (!IS_ENABLED(CONFIG_COMPAT_32BIT_TIME))
139 return -ENOSYS;
133 return compat_ksys_semtimedop(first, compat_ptr(ptr), second, 140 return compat_ksys_semtimedop(first, compat_ptr(ptr), second,
134 compat_ptr(fifth)); 141 compat_ptr(fifth));
135 case SEMGET: 142 case SEMGET:
diff --git a/ipc/util.h b/ipc/util.h
index acc5159e96d0..0aba3230d007 100644
--- a/ipc/util.h
+++ b/ipc/util.h
@@ -251,7 +251,7 @@ static inline int compat_ipc_parse_version(int *cmd)
251/* for __ARCH_WANT_SYS_IPC */ 251/* for __ARCH_WANT_SYS_IPC */
252long ksys_semtimedop(int semid, struct sembuf __user *tsops, 252long ksys_semtimedop(int semid, struct sembuf __user *tsops,
253 unsigned int nsops, 253 unsigned int nsops,
254 const struct timespec __user *timeout); 254 const struct __kernel_timespec __user *timeout);
255long ksys_semget(key_t key, int nsems, int semflg); 255long ksys_semget(key_t key, int nsems, int semflg);
256long ksys_semctl(int semid, int semnum, int cmd, unsigned long arg); 256long ksys_semctl(int semid, int semnum, int cmd, unsigned long arg);
257long ksys_msgget(key_t key, int msgflg); 257long ksys_msgget(key_t key, int msgflg);
@@ -265,10 +265,10 @@ long ksys_shmdt(char __user *shmaddr);
265long ksys_shmctl(int shmid, int cmd, struct shmid_ds __user *buf); 265long ksys_shmctl(int shmid, int cmd, struct shmid_ds __user *buf);
266 266
267/* for CONFIG_ARCH_WANT_OLD_COMPAT_IPC */ 267/* for CONFIG_ARCH_WANT_OLD_COMPAT_IPC */
268#ifdef CONFIG_COMPAT
269long compat_ksys_semtimedop(int semid, struct sembuf __user *tsems, 268long compat_ksys_semtimedop(int semid, struct sembuf __user *tsems,
270 unsigned int nsops, 269 unsigned int nsops,
271 const struct compat_timespec __user *timeout); 270 const struct compat_timespec __user *timeout);
271#ifdef CONFIG_COMPAT
272long compat_ksys_semctl(int semid, int semnum, int cmd, int arg); 272long compat_ksys_semctl(int semid, int semnum, int cmd, int arg);
273long compat_ksys_msgctl(int msqid, int cmd, void __user *uptr); 273long compat_ksys_msgctl(int msqid, int cmd, void __user *uptr);
274long compat_ksys_msgrcv(int msqid, compat_uptr_t msgp, compat_ssize_t msgsz, 274long compat_ksys_msgrcv(int msqid, compat_uptr_t msgp, compat_ssize_t msgsz,
diff --git a/kernel/time/time.c b/kernel/time/time.c
index ccd751e95fcb..6fa99213fc72 100644
--- a/kernel/time/time.c
+++ b/kernel/time/time.c
@@ -407,7 +407,6 @@ time64_t mktime64(const unsigned int year0, const unsigned int mon0,
407} 407}
408EXPORT_SYMBOL(mktime64); 408EXPORT_SYMBOL(mktime64);
409 409
410#if __BITS_PER_LONG == 32
411/** 410/**
412 * set_normalized_timespec - set timespec sec and nsec parts and normalize 411 * set_normalized_timespec - set timespec sec and nsec parts and normalize
413 * 412 *
@@ -468,7 +467,6 @@ struct timespec ns_to_timespec(const s64 nsec)
468 return ts; 467 return ts;
469} 468}
470EXPORT_SYMBOL(ns_to_timespec); 469EXPORT_SYMBOL(ns_to_timespec);
471#endif
472 470
473/** 471/**
474 * ns_to_timeval - Convert nanoseconds to timeval 472 * ns_to_timeval - Convert nanoseconds to timeval
diff --git a/kernel/time/timekeeping.c b/kernel/time/timekeeping.c
index 49cbceef5deb..4786df904c22 100644
--- a/kernel/time/timekeeping.c
+++ b/kernel/time/timekeeping.c
@@ -705,18 +705,19 @@ static void timekeeping_forward_now(struct timekeeper *tk)
705} 705}
706 706
707/** 707/**
708 * __getnstimeofday64 - Returns the time of day in a timespec64. 708 * ktime_get_real_ts64 - Returns the time of day in a timespec64.
709 * @ts: pointer to the timespec to be set 709 * @ts: pointer to the timespec to be set
710 * 710 *
711 * Updates the time of day in the timespec. 711 * Returns the time of day in a timespec64 (WARN if suspended).
712 * Returns 0 on success, or -ve when suspended (timespec will be undefined).
713 */ 712 */
714int __getnstimeofday64(struct timespec64 *ts) 713void ktime_get_real_ts64(struct timespec64 *ts)
715{ 714{
716 struct timekeeper *tk = &tk_core.timekeeper; 715 struct timekeeper *tk = &tk_core.timekeeper;
717 unsigned long seq; 716 unsigned long seq;
718 u64 nsecs; 717 u64 nsecs;
719 718
719 WARN_ON(timekeeping_suspended);
720
720 do { 721 do {
721 seq = read_seqcount_begin(&tk_core.seq); 722 seq = read_seqcount_begin(&tk_core.seq);
722 723
@@ -727,28 +728,8 @@ int __getnstimeofday64(struct timespec64 *ts)
727 728
728 ts->tv_nsec = 0; 729 ts->tv_nsec = 0;
729 timespec64_add_ns(ts, nsecs); 730 timespec64_add_ns(ts, nsecs);
730
731 /*
732 * Do not bail out early, in case there were callers still using
733 * the value, even in the face of the WARN_ON.
734 */
735 if (unlikely(timekeeping_suspended))
736 return -EAGAIN;
737 return 0;
738}
739EXPORT_SYMBOL(__getnstimeofday64);
740
741/**
742 * getnstimeofday64 - Returns the time of day in a timespec64.
743 * @ts: pointer to the timespec64 to be set
744 *
745 * Returns the time of day in a timespec64 (WARN if suspended).
746 */
747void getnstimeofday64(struct timespec64 *ts)
748{
749 WARN_ON(__getnstimeofday64(ts));
750} 731}
751EXPORT_SYMBOL(getnstimeofday64); 732EXPORT_SYMBOL(ktime_get_real_ts64);
752 733
753ktime_t ktime_get(void) 734ktime_t ktime_get(void)
754{ 735{
@@ -814,6 +795,25 @@ ktime_t ktime_get_with_offset(enum tk_offsets offs)
814} 795}
815EXPORT_SYMBOL_GPL(ktime_get_with_offset); 796EXPORT_SYMBOL_GPL(ktime_get_with_offset);
816 797
798ktime_t ktime_get_coarse_with_offset(enum tk_offsets offs)
799{
800 struct timekeeper *tk = &tk_core.timekeeper;
801 unsigned int seq;
802 ktime_t base, *offset = offsets[offs];
803
804 WARN_ON(timekeeping_suspended);
805
806 do {
807 seq = read_seqcount_begin(&tk_core.seq);
808 base = ktime_add(tk->tkr_mono.base, *offset);
809
810 } while (read_seqcount_retry(&tk_core.seq, seq));
811
812 return base;
813
814}
815EXPORT_SYMBOL_GPL(ktime_get_coarse_with_offset);
816
817/** 817/**
818 * ktime_mono_to_any() - convert mononotic time to any other time 818 * ktime_mono_to_any() - convert mononotic time to any other time
819 * @tmono: time to convert. 819 * @tmono: time to convert.
@@ -1410,12 +1410,12 @@ int timekeeping_notify(struct clocksource *clock)
1410} 1410}
1411 1411
1412/** 1412/**
1413 * getrawmonotonic64 - Returns the raw monotonic time in a timespec 1413 * ktime_get_raw_ts64 - Returns the raw monotonic time in a timespec
1414 * @ts: pointer to the timespec64 to be set 1414 * @ts: pointer to the timespec64 to be set
1415 * 1415 *
1416 * Returns the raw monotonic time (completely un-modified by ntp) 1416 * Returns the raw monotonic time (completely un-modified by ntp)
1417 */ 1417 */
1418void getrawmonotonic64(struct timespec64 *ts) 1418void ktime_get_raw_ts64(struct timespec64 *ts)
1419{ 1419{
1420 struct timekeeper *tk = &tk_core.timekeeper; 1420 struct timekeeper *tk = &tk_core.timekeeper;
1421 unsigned long seq; 1421 unsigned long seq;
@@ -1431,7 +1431,7 @@ void getrawmonotonic64(struct timespec64 *ts)
1431 ts->tv_nsec = 0; 1431 ts->tv_nsec = 0;
1432 timespec64_add_ns(ts, nsecs); 1432 timespec64_add_ns(ts, nsecs);
1433} 1433}
1434EXPORT_SYMBOL(getrawmonotonic64); 1434EXPORT_SYMBOL(ktime_get_raw_ts64);
1435 1435
1436 1436
1437/** 1437/**
@@ -2133,23 +2133,20 @@ unsigned long get_seconds(void)
2133} 2133}
2134EXPORT_SYMBOL(get_seconds); 2134EXPORT_SYMBOL(get_seconds);
2135 2135
2136struct timespec64 current_kernel_time64(void) 2136void ktime_get_coarse_real_ts64(struct timespec64 *ts)
2137{ 2137{
2138 struct timekeeper *tk = &tk_core.timekeeper; 2138 struct timekeeper *tk = &tk_core.timekeeper;
2139 struct timespec64 now;
2140 unsigned long seq; 2139 unsigned long seq;
2141 2140
2142 do { 2141 do {
2143 seq = read_seqcount_begin(&tk_core.seq); 2142 seq = read_seqcount_begin(&tk_core.seq);
2144 2143
2145 now = tk_xtime(tk); 2144 *ts = tk_xtime(tk);
2146 } while (read_seqcount_retry(&tk_core.seq, seq)); 2145 } while (read_seqcount_retry(&tk_core.seq, seq));
2147
2148 return now;
2149} 2146}
2150EXPORT_SYMBOL(current_kernel_time64); 2147EXPORT_SYMBOL(ktime_get_coarse_real_ts64);
2151 2148
2152struct timespec64 get_monotonic_coarse64(void) 2149void ktime_get_coarse_ts64(struct timespec64 *ts)
2153{ 2150{
2154 struct timekeeper *tk = &tk_core.timekeeper; 2151 struct timekeeper *tk = &tk_core.timekeeper;
2155 struct timespec64 now, mono; 2152 struct timespec64 now, mono;
@@ -2162,12 +2159,10 @@ struct timespec64 get_monotonic_coarse64(void)
2162 mono = tk->wall_to_monotonic; 2159 mono = tk->wall_to_monotonic;
2163 } while (read_seqcount_retry(&tk_core.seq, seq)); 2160 } while (read_seqcount_retry(&tk_core.seq, seq));
2164 2161
2165 set_normalized_timespec64(&now, now.tv_sec + mono.tv_sec, 2162 set_normalized_timespec64(ts, now.tv_sec + mono.tv_sec,
2166 now.tv_nsec + mono.tv_nsec); 2163 now.tv_nsec + mono.tv_nsec);
2167
2168 return now;
2169} 2164}
2170EXPORT_SYMBOL(get_monotonic_coarse64); 2165EXPORT_SYMBOL(ktime_get_coarse_ts64);
2171 2166
2172/* 2167/*
2173 * Must hold jiffies_lock 2168 * Must hold jiffies_lock