aboutsummaryrefslogtreecommitdiff
path: root/sysdeps/unix
diff options
context:
space:
mode:
authorH. Peter Anvin (Intel) <hpa@zytor.com>2025-06-11 18:35:35 -0700
committerAdhemerval Zanella <adhemerval.zanella@linaro.org>2025-06-17 09:11:38 -0300
commit5f54d8bc48983bed844c02e1fe614ad223e78838 (patch)
treea482b3652d7f126e8f0f0e97bac336fda82d6d08 /sysdeps/unix
parent091256f0d1be5efebe5fede0d710e0de7375124d (diff)
downloadglibc-5f54d8bc48983bed844c02e1fe614ad223e78838.zip
glibc-5f54d8bc48983bed844c02e1fe614ad223e78838.tar.gz
glibc-5f54d8bc48983bed844c02e1fe614ad223e78838.tar.bz2
linux/termios/powerpc: deal with powerpc-unique ioctl emulation
The powerpc architecture, only, emulates the termios ioctls using the glibc termios structure. Export the real kernel ones as the termios2 interface; although the kernel doesn't call it termios2, it is exactly the termios2 interface, and it avoids the namespace clash between the emulated ioctls and the real kernel ioctls. Signed-off-by: H. Peter Anvin (Intel) <hpa@zytor.com> Reviewed-by: Adhemerval Zanella <adhemerval.zanella@linaro.org>
Diffstat (limited to 'sysdeps/unix')
-rw-r--r--sysdeps/unix/sysv/linux/powerpc/bits/ioctls.h36
1 files changed, 36 insertions, 0 deletions
diff --git a/sysdeps/unix/sysv/linux/powerpc/bits/ioctls.h b/sysdeps/unix/sysv/linux/powerpc/bits/ioctls.h
new file mode 100644
index 0000000..e1921df
--- /dev/null
+++ b/sysdeps/unix/sysv/linux/powerpc/bits/ioctls.h
@@ -0,0 +1,36 @@
+/* Copyright (C) 1996-2025 Free Software Foundation, Inc.
+ This file is part of the GNU C Library.
+
+ The GNU C Library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Lesser General Public
+ License as published by the Free Software Foundation; either
+ version 2.1 of the License, or (at your option) any later version.
+
+ The GNU C Library is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ Lesser General Public License for more details.
+
+ You should have received a copy of the GNU Lesser General Public
+ License along with the GNU C Library; if not, see
+ <https://www.gnu.org/licenses/>. */
+
+#ifndef _SYS_IOCTL_H
+# error "Never use <bits/ioctls.h> directly; include <sys/ioctl.h> instead."
+#endif
+
+/* Use the definitions from the kernel header files. */
+#include <asm/ioctls.h>
+
+/* PowerPC quirk: on PowerPC only, ioctl() emulates the TCGETS/TCSETS*
+ ioctls with tcgetattr/tcsetattr using the glibc struct termios.
+ As struct termios2 is the same as the kernel struct termios on PowerPC,
+ simply consider the kernel ones as the termios2 interface, even
+ though the kernel doesn't call it that. */
+
+#define TCGETS2 _IOR ('t', 19, struct termios2)
+#define TCSETS2 _IOW ('t', 20, struct termios2)
+#define TCSETSW2 _IOW ('t', 21, struct termios2)
+#define TCSETSF2 _IOW ('t', 22, struct termios2)
+
+#include <linux/sockios.h>