about summary refs log tree commit diff
path: root/sysdeps/unix/sysv/linux/ipc_priv.h
diff options
context:
space:
mode:
authorFlorian Weimer <fweimer@redhat.com>2022-11-08 14:15:02 +0100
committerFlorian Weimer <fweimer@redhat.com>2022-11-10 14:21:34 +0100
commit22a46dee24351fd5f4f188ad80554cad79c82524 (patch)
tree7e86fc7fea71a9cd34b2ebc723e5b7b66d371ef2 /sysdeps/unix/sysv/linux/ipc_priv.h
parent38caf7a1cc92e6a546ea655701c8237ee727d0d3 (diff)
downloadglibc-22a46dee24351fd5f4f188ad80554cad79c82524.tar.gz
glibc-22a46dee24351fd5f4f188ad80554cad79c82524.tar.xz
glibc-22a46dee24351fd5f4f188ad80554cad79c82524.zip
Linux: Support __IPC_64 in sysvctl *ctl command arguments (bug 29771)
Old applications pass __IPC_64 as part of the command argument because
old glibc did not check for unknown commands, and passed through the
arguments directly to the kernel, without adding __IPC_64.
Applications need to continue doing that for old glibc compatibility,
so this commit enables this approach in current glibc.

For msgctl and shmctl, if no translation is required, make
direct system calls, as we did before the time64 changes.  If
translation is required, mask __IPC_64 from the command argument.

For semctl, the union-in-vararg argument handling means that
translation is needed on all architectures.

Reviewed-by: Adhemerval Zanella  <adhemerval.zanella@linaro.org>
Diffstat (limited to 'sysdeps/unix/sysv/linux/ipc_priv.h')
-rw-r--r--sysdeps/unix/sysv/linux/ipc_priv.h6
1 files changed, 6 insertions, 0 deletions
diff --git a/sysdeps/unix/sysv/linux/ipc_priv.h b/sysdeps/unix/sysv/linux/ipc_priv.h
index 87893a6757..2f50c31a8e 100644
--- a/sysdeps/unix/sysv/linux/ipc_priv.h
+++ b/sysdeps/unix/sysv/linux/ipc_priv.h
@@ -63,4 +63,10 @@ struct __old_ipc_perm
 # define __IPC_TIME64 0
 #endif
 
+#if __IPC_TIME64 || defined __ASSUME_SYSVIPC_BROKEN_MODE_T
+# define IPC_CTL_NEED_TRANSLATION 1
+#else
+# define IPC_CTL_NEED_TRANSLATION 0
+#endif
+
 #include <ipc_ops.h>