From: Rich Felker Date: Tue, 30 Jul 2019 17:07:55 +0000 (-0400) Subject: move IPC_64 from public bits/ipc.h to syscall_arch.h X-Git-Tag: v1.1.24~74 X-Git-Url: https://git.librecmc.org/?a=commitdiff_plain;h=f56d57f8a7aa536d40014933841a8b22f9c10328;p=oweals%2Fmusl.git move IPC_64 from public bits/ipc.h to syscall_arch.h 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. --- diff --git a/arch/aarch64/bits/ipc.h b/arch/aarch64/bits/ipc.h index 6f3328a8..ef39a0ca 100644 --- a/arch/aarch64/bits/ipc.h +++ b/arch/aarch64/bits/ipc.h @@ -10,5 +10,3 @@ struct ipc_perm { unsigned long __pad1; unsigned long __pad2; }; - -#define IPC_64 0 diff --git a/arch/aarch64/syscall_arch.h b/arch/aarch64/syscall_arch.h index 25f5ce67..504983aa 100644 --- a/arch/aarch64/syscall_arch.h +++ b/arch/aarch64/syscall_arch.h @@ -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 diff --git a/arch/generic/bits/ipc.h b/arch/generic/bits/ipc.h index 779c42fd..40d6f3a2 100644 --- a/arch/generic/bits/ipc.h +++ b/arch/generic/bits/ipc.h @@ -9,5 +9,3 @@ struct ipc_perm { long __pad1; long __pad2; }; - -#define IPC_64 0x100 diff --git a/arch/mips64/bits/ipc.h b/arch/mips64/bits/ipc.h index 43a8314e..df227168 100644 --- a/arch/mips64/bits/ipc.h +++ b/arch/mips64/bits/ipc.h @@ -10,5 +10,3 @@ struct ipc_perm { unsigned long __unused1; unsigned long __unused2; }; - -#define IPC_64 0x100 diff --git a/arch/or1k/bits/ipc.h b/arch/or1k/bits/ipc.h index 3d894e30..40d6f3a2 100644 --- a/arch/or1k/bits/ipc.h +++ b/arch/or1k/bits/ipc.h @@ -9,5 +9,3 @@ struct ipc_perm { long __pad1; long __pad2; }; - -#define IPC_64 0 diff --git a/arch/or1k/syscall_arch.h b/arch/or1k/syscall_arch.h index 5a9b074a..21738ce0 100644 --- a/arch/or1k/syscall_arch.h +++ b/arch/or1k/syscall_arch.h @@ -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 diff --git a/arch/powerpc/bits/ipc.h b/arch/powerpc/bits/ipc.h index 3f2ede07..a388d56b 100644 --- a/arch/powerpc/bits/ipc.h +++ b/arch/powerpc/bits/ipc.h @@ -10,6 +10,3 @@ struct ipc_perm { long long __pad2; long long __pad3; }; - -#define IPC_64 0x100 - diff --git a/arch/powerpc64/bits/ipc.h b/arch/powerpc64/bits/ipc.h index 3f2ede07..a388d56b 100644 --- a/arch/powerpc64/bits/ipc.h +++ b/arch/powerpc64/bits/ipc.h @@ -10,6 +10,3 @@ struct ipc_perm { long long __pad2; long long __pad3; }; - -#define IPC_64 0x100 - diff --git a/arch/riscv64/bits/ipc.h b/arch/riscv64/bits/ipc.h index 6f3328a8..ef39a0ca 100644 --- a/arch/riscv64/bits/ipc.h +++ b/arch/riscv64/bits/ipc.h @@ -10,5 +10,3 @@ struct ipc_perm { unsigned long __pad1; unsigned long __pad2; }; - -#define IPC_64 0 diff --git a/arch/riscv64/syscall_arch.h b/arch/riscv64/syscall_arch.h index 3e0804ef..7fd042cd 100644 --- a/arch/riscv64/syscall_arch.h +++ b/arch/riscv64/syscall_arch.h @@ -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 diff --git a/arch/s390x/bits/ipc.h b/arch/s390x/bits/ipc.h index 4710c12b..b71be9ec 100644 --- a/arch/s390x/bits/ipc.h +++ b/arch/s390x/bits/ipc.h @@ -10,5 +10,3 @@ struct ipc_perm { unsigned long __pad2; unsigned long __pad3; }; - -#define IPC_64 0x100 diff --git a/arch/x32/bits/ipc.h b/arch/x32/bits/ipc.h index 55d2e41a..a12380f6 100644 --- a/arch/x32/bits/ipc.h +++ b/arch/x32/bits/ipc.h @@ -9,5 +9,3 @@ struct ipc_perm { long long __pad1; long long __pad2; }; - -#define IPC_64 0 diff --git a/arch/x32/syscall_arch.h b/arch/x32/syscall_arch.h index 81d1d0df..e0a22160 100644 --- a/arch/x32/syscall_arch.h +++ b/arch/x32/syscall_arch.h @@ -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 diff --git a/arch/x86_64/bits/ipc.h b/arch/x86_64/bits/ipc.h index 3d894e30..40d6f3a2 100644 --- a/arch/x86_64/bits/ipc.h +++ b/arch/x86_64/bits/ipc.h @@ -9,5 +9,3 @@ struct ipc_perm { long __pad1; long __pad2; }; - -#define IPC_64 0 diff --git a/arch/x86_64/syscall_arch.h b/arch/x86_64/syscall_arch.h index 54e05ff6..92d5c179 100644 --- a/arch/x86_64/syscall_arch.h +++ b/arch/x86_64/syscall_arch.h @@ -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 diff --git a/src/ipc/ipc.h b/src/ipc/ipc.h index 30ab939a..36f3e213 100644 --- a/src/ipc/ipc.h +++ b/src/ipc/ipc.h @@ -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