extricate bits/sem.h from x32 time_t hack
authorRich Felker <dalias@aerifal.cx>
Mon, 29 Jul 2019 22:03:41 +0000 (18:03 -0400)
committerRich Felker <dalias@aerifal.cx>
Mon, 29 Jul 2019 22:03:41 +0000 (18:03 -0400)
various padding fields in the generic bits/sem.h were defined in terms
of time_t as a cheap hack standing in for "kernel long", to allow x32
to use the generic version of the file. this was a really bad idea, as
it ended up getting copied into lots of arch-specific versions of the
bits file, and is a blocker to changing time_t to 64-bit on 32-bit
archs.

this commit adds an x32-specific version of the header, and changes
padding type back from time_t to long (currently the same type on all
archs but x32) in the generic header and all the others the hack got
copied into.

arch/aarch64/bits/sem.h
arch/generic/bits/sem.h
arch/mips/bits/sem.h
arch/mips64/bits/sem.h
arch/mipsn32/bits/sem.h
arch/riscv64/bits/sem.h
arch/x32/bits/sem.h [new file with mode: 0644]

index e46ced95d2be4c4ef568b4717d1012d1cfdb2d30..5184eb5977ece3775fe5f7a6659a83d6da24ca44 100644 (file)
@@ -4,11 +4,11 @@ struct semid_ds {
        time_t sem_ctime;
 #if __BYTE_ORDER == __LITTLE_ENDIAN
        unsigned short sem_nsems;
-       char __sem_nsems_pad[sizeof(time_t)-sizeof(short)];
+       char __sem_nsems_pad[sizeof(long)-sizeof(short)];
 #else
-       char __sem_nsems_pad[sizeof(time_t)-sizeof(short)];
+       char __sem_nsems_pad[sizeof(long)-sizeof(short)];
        unsigned short sem_nsems;
 #endif
-       time_t __unused3;
-       time_t __unused4;
+       long __unused3;
+       long __unused4;
 };
index c629b81ebb2a097b823aae6caac56cf34f2b2dc8..d383d4ea552d9a092e3960e36d1dc3f97feaecdd 100644 (file)
@@ -1,16 +1,16 @@
 struct semid_ds {
        struct ipc_perm sem_perm;
        time_t sem_otime;
-       time_t __unused1;
+       long __unused1;
        time_t sem_ctime;
-       time_t __unused2;
+       long __unused2;
 #if __BYTE_ORDER == __LITTLE_ENDIAN
        unsigned short sem_nsems;
-       char __sem_nsems_pad[sizeof(time_t)-sizeof(short)];
+       char __sem_nsems_pad[sizeof(long)-sizeof(short)];
 #else
-       char __sem_nsems_pad[sizeof(time_t)-sizeof(short)];
+       char __sem_nsems_pad[sizeof(long)-sizeof(short)];
        unsigned short sem_nsems;
 #endif
-       time_t __unused3;
-       time_t __unused4;
+       long __unused3;
+       long __unused4;
 };
index e46ced95d2be4c4ef568b4717d1012d1cfdb2d30..5184eb5977ece3775fe5f7a6659a83d6da24ca44 100644 (file)
@@ -4,11 +4,11 @@ struct semid_ds {
        time_t sem_ctime;
 #if __BYTE_ORDER == __LITTLE_ENDIAN
        unsigned short sem_nsems;
-       char __sem_nsems_pad[sizeof(time_t)-sizeof(short)];
+       char __sem_nsems_pad[sizeof(long)-sizeof(short)];
 #else
-       char __sem_nsems_pad[sizeof(time_t)-sizeof(short)];
+       char __sem_nsems_pad[sizeof(long)-sizeof(short)];
        unsigned short sem_nsems;
 #endif
-       time_t __unused3;
-       time_t __unused4;
+       long __unused3;
+       long __unused4;
 };
index e46ced95d2be4c4ef568b4717d1012d1cfdb2d30..5184eb5977ece3775fe5f7a6659a83d6da24ca44 100644 (file)
@@ -4,11 +4,11 @@ struct semid_ds {
        time_t sem_ctime;
 #if __BYTE_ORDER == __LITTLE_ENDIAN
        unsigned short sem_nsems;
-       char __sem_nsems_pad[sizeof(time_t)-sizeof(short)];
+       char __sem_nsems_pad[sizeof(long)-sizeof(short)];
 #else
-       char __sem_nsems_pad[sizeof(time_t)-sizeof(short)];
+       char __sem_nsems_pad[sizeof(long)-sizeof(short)];
        unsigned short sem_nsems;
 #endif
-       time_t __unused3;
-       time_t __unused4;
+       long __unused3;
+       long __unused4;
 };
index e46ced95d2be4c4ef568b4717d1012d1cfdb2d30..5184eb5977ece3775fe5f7a6659a83d6da24ca44 100644 (file)
@@ -4,11 +4,11 @@ struct semid_ds {
        time_t sem_ctime;
 #if __BYTE_ORDER == __LITTLE_ENDIAN
        unsigned short sem_nsems;
-       char __sem_nsems_pad[sizeof(time_t)-sizeof(short)];
+       char __sem_nsems_pad[sizeof(long)-sizeof(short)];
 #else
-       char __sem_nsems_pad[sizeof(time_t)-sizeof(short)];
+       char __sem_nsems_pad[sizeof(long)-sizeof(short)];
        unsigned short sem_nsems;
 #endif
-       time_t __unused3;
-       time_t __unused4;
+       long __unused3;
+       long __unused4;
 };
index 5f93c12dda307e98ca7f1e7e9516ff7c992ade88..7b434413bc1b15beb74ee119f664d8b9a116039b 100644 (file)
@@ -3,7 +3,7 @@ struct semid_ds {
        time_t sem_otime;
        time_t sem_ctime;
        unsigned short sem_nsems;
-       char __sem_nsems_pad[sizeof(time_t)-sizeof(short)];
-       time_t __unused3;
-       time_t __unused4;
+       char __sem_nsems_pad[sizeof(long)-sizeof(short)];
+       long __unused3;
+       long __unused4;
 };
diff --git a/arch/x32/bits/sem.h b/arch/x32/bits/sem.h
new file mode 100644 (file)
index 0000000..18745f4
--- /dev/null
@@ -0,0 +1,11 @@
+struct semid_ds {
+       struct ipc_perm sem_perm;
+       time_t sem_otime;
+       long long __unused1;
+       time_t sem_ctime;
+       long long __unused2;
+       unsigned short sem_nsems;
+       char __sem_nsems_pad[sizeof(long long)-sizeof(short)];
+       long long __unused3;
+       long long __unused4;
+};