aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorArnd Bergmann <arnd@arndb.de>2015-05-05 17:19:43 -0400
committerArnd Bergmann <arnd@arndb.de>2018-04-20 10:20:10 -0400
commit91b9b0d71879eba67c93edd05e94bd3e28e1f199 (patch)
tree296c765e06623408cc030a701c11fbc815b79a2d
parentf69c97f6a48c6154768dd6a35b13f090d5bee0ad (diff)
y2038: sparc: Extend sysvipc data structures
sparc, uses a nonstandard variation of the generic sysvipc data structures, intended to have the padding moved around so it can deal with big-endian 32-bit user space that has 64-bit time_t. Unlike most architectures, sparc actually succeeded in defining this right for big-endian CPUs, but as everyone else got it wrong, we just use the same hack everywhere. This takes just take the same approach here that we have for the asm-generic headers and adds separate 32-bit fields for the upper halves of the timestamps, to let libc deal with the mess in user space. Signed-off-by: Arnd Bergmann <arnd@arndb.de>
-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
4 files changed, 41 insertions, 50 deletions
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 */