move IPC_64 from public bits/ipc.h to syscall_arch.h
authorRich Felker <dalias@aerifal.cx>
Tue, 30 Jul 2019 17:07:55 +0000 (13:07 -0400)
committerRich Felker <dalias@aerifal.cx>
Tue, 30 Jul 2019 18:23:56 +0000 (14:23 -0400)
the definition of the IPC_64 macro controls the interface between libc
and the kernel through syscalls; it's not a public API. the meaning is
rather obscure. long ago, Linux's sysvipc *id_ds structures used
16-bit uids/gids and wrong types for a few other fields. this was in
the libc5 era, before glibc. the IPC_64 flag (64 is a misnomer; it's
more like 32) tells the kernel to use the modern[-ish] versions of the
structures.

the definition of IPC_64 has nothing to do with whether the arch is
32- or 64-bit. rather, due to either historical accident or
intentional obnoxiousness, the kernel only accepts and masks off the
0x100 IPC_64 flag conditional on CONFIG_ARCH_WANT_IPC_PARSE_VERSION,
i.e. for archs that want to provide, or that accidentally provided,
both. for archs which don't define this option, no masking is
performed and commands with the 0x100 bit set will fail as invalid. so
ultimately, the definition is just a matter of matching an arbitrary
switch defined per-arch in the kernel.

16 files changed:
arch/aarch64/bits/ipc.h
arch/aarch64/syscall_arch.h
arch/generic/bits/ipc.h
arch/mips64/bits/ipc.h
arch/or1k/bits/ipc.h
arch/or1k/syscall_arch.h
arch/powerpc/bits/ipc.h
arch/powerpc64/bits/ipc.h
arch/riscv64/bits/ipc.h
arch/riscv64/syscall_arch.h
arch/s390x/bits/ipc.h
arch/x32/bits/ipc.h
arch/x32/syscall_arch.h
arch/x86_64/bits/ipc.h
arch/x86_64/syscall_arch.h
src/ipc/ipc.h

index 6f3328a..ef39a0c 100644 (file)
@@ -10,5 +10,3 @@ struct ipc_perm {
        unsigned long __pad1;
        unsigned long __pad2;
 };
-
-#define IPC_64 0
index 25f5ce6..504983a 100644 (file)
@@ -74,3 +74,5 @@ static inline long __syscall6(long n, long a, long b, long c, long d, long e, lo
 #define VDSO_USEFUL
 #define VDSO_CGT_SYM "__kernel_clock_gettime"
 #define VDSO_CGT_VER "LINUX_2.6.39"
+
+#define IPC_64 0
index 779c42f..40d6f3a 100644 (file)
@@ -9,5 +9,3 @@ struct ipc_perm {
        long __pad1;
        long __pad2;
 };
-
-#define IPC_64 0x100
index 43a8314..df22716 100644 (file)
@@ -10,5 +10,3 @@ struct ipc_perm {
        unsigned long __unused1;
        unsigned long __unused2;
 };
-
-#define IPC_64 0x100
index 3d894e3..40d6f3a 100644 (file)
@@ -9,5 +9,3 @@ struct ipc_perm {
        long __pad1;
        long __pad2;
 };
-
-#define IPC_64 0
index 5a9b074..21738ce 100644 (file)
@@ -111,3 +111,5 @@ static inline long __syscall6(long n, long a, long b, long c, long d, long e, lo
                                "r23", "r25", "r27", "r29", "r31");
        return r11;
 }
+
+#define IPC_64 0
index 3f2ede0..a388d56 100644 (file)
@@ -10,6 +10,3 @@ struct ipc_perm {
        long long __pad2;
        long long __pad3;
 };
-
-#define IPC_64 0x100
-
index 3f2ede0..a388d56 100644 (file)
@@ -10,6 +10,3 @@ struct ipc_perm {
        long long __pad2;
        long long __pad3;
 };
-
-#define IPC_64 0x100
-
index 6f3328a..ef39a0c 100644 (file)
@@ -10,5 +10,3 @@ struct ipc_perm {
        unsigned long __pad1;
        unsigned long __pad2;
 };
-
-#define IPC_64 0
index 3e0804e..7fd042c 100644 (file)
@@ -74,3 +74,5 @@ static inline long __syscall6(long n, long a, long b, long c, long d, long e, lo
 /* We don't have a clock_gettime function.
 #define VDSO_CGT_SYM "__vdso_clock_gettime"
 #define VDSO_CGT_VER "LINUX_2.6" */
+
+#define IPC_64 0
index 4710c12..b71be9e 100644 (file)
@@ -10,5 +10,3 @@ struct ipc_perm {
        unsigned long __pad2;
        unsigned long __pad3;
 };
-
-#define IPC_64 0x100
index 55d2e41..a12380f 100644 (file)
@@ -9,5 +9,3 @@ struct ipc_perm {
        long long __pad1;
        long long __pad2;
 };
-
-#define IPC_64 0
index 81d1d0d..e0a2216 100644 (file)
@@ -87,3 +87,5 @@ static __inline long __syscall6(long long n, long long a1, long long a2, long lo
 #define SYS_rt_sigtimedwait_time64 SYS_rt_sigtimedwait
 #define SYS_futex_time64 SYS_futex
 #define SYS_sched_rr_get_interval_time64 SYS_sched_rr_get_interval
+
+#define IPC_64 0
index 3d894e3..40d6f3a 100644 (file)
@@ -9,5 +9,3 @@ struct ipc_perm {
        long __pad1;
        long __pad2;
 };
-
-#define IPC_64 0
index 54e05ff..92d5c17 100644 (file)
@@ -66,3 +66,5 @@ static __inline long __syscall6(long n, long a1, long a2, long a3, long a4, long
 #define VDSO_CGT_VER "LINUX_2.6"
 #define VDSO_GETCPU_SYM "__vdso_getcpu"
 #define VDSO_GETCPU_VER "LINUX_2.6"
+
+#define IPC_64 0
index 30ab939..36f3e21 100644 (file)
@@ -1,3 +1,5 @@
+#include "syscall.h"
+
 #define IPCOP_semop      1
 #define IPCOP_semget     2
 #define IPCOP_semctl     3
@@ -10,3 +12,7 @@
 #define IPCOP_shmdt     22
 #define IPCOP_shmget    23
 #define IPCOP_shmctl    24
+
+#ifndef IPC_64
+#define IPC_64 0x100
+#endif