[PATCH v4] sparc: don't reference obsolete termio struct for TC* constants

Sam James posted 1 patch 3 days, 15 hours ago
arch/sparc/include/uapi/asm/ioctls.h | 8 ++++----
1 file changed, 4 insertions(+), 4 deletions(-)
[PATCH v4] sparc: don't reference obsolete termio struct for TC* constants
Posted by Sam James 3 days, 15 hours ago
Similar in nature to commit ab107276607a ("powerpc: Fix struct termio related ioctl macros").

glibc-2.42 drops the legacy termio struct, but the ioctls.h header still
defines some TC* constants in terms of termio (via sizeof). Hardcode the
values instead.

This fixes building Python for example, which falls over like:
  ./Modules/termios.c:1119:16: error: invalid application of 'sizeof' to incomplete type 'struct termio'

Link: https://bugs.gentoo.org/961769
Link: https://bugs.gentoo.org/962600
Signed-off-by: Sam James <sam@gentoo.org>
---
v4: Tweak commit message for commit ref and add comments for old definitions.
v3: Fix constants.
v2: Fix title.

 arch/sparc/include/uapi/asm/ioctls.h | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)

diff --git a/arch/sparc/include/uapi/asm/ioctls.h b/arch/sparc/include/uapi/asm/ioctls.h
index 7fd2f5873c9e..a8bbdf9877a4 100644
--- a/arch/sparc/include/uapi/asm/ioctls.h
+++ b/arch/sparc/include/uapi/asm/ioctls.h
@@ -5,10 +5,10 @@
 #include <asm/ioctl.h>
 
 /* Big T */
-#define TCGETA		_IOR('T', 1, struct termio)
-#define TCSETA		_IOW('T', 2, struct termio)
-#define TCSETAW		_IOW('T', 3, struct termio)
-#define TCSETAF		_IOW('T', 4, struct termio)
+#define TCGETA          0x40125401 /* _IOR('T', 1, struct termio) */
+#define TCSETA          0x80125402 /* _IOW('T', 2, struct termio) */
+#define TCSETAW         0x80125403 /* _IOW('T', 3, struct termio) */
+#define TCSETAF         0x80125404 /* _IOW('T', 4, struct termio) */
 #define TCSBRK		_IO('T', 5)
 #define TCXONC		_IO('T', 6)
 #define TCFLSH		_IO('T', 7)
-- 
2.53.0
Re: [PATCH v4] sparc: don't reference obsolete termio struct for TC* constants
Posted by Andreas Larsson 1 day, 18 hours ago
On 2026-02-04 14:40, Sam James wrote:
> Similar in nature to commit ab107276607a ("powerpc: Fix struct termio related ioctl macros").
> 
> glibc-2.42 drops the legacy termio struct, but the ioctls.h header still
> defines some TC* constants in terms of termio (via sizeof). Hardcode the
> values instead.
> 
> This fixes building Python for example, which falls over like:
>   ./Modules/termios.c:1119:16: error: invalid application of 'sizeof' to incomplete type 'struct termio'
> 
> Link: https://bugs.gentoo.org/961769
> Link: https://bugs.gentoo.org/962600
> Signed-off-by: Sam James <sam@gentoo.org>
> ---
> v4: Tweak commit message for commit ref and add comments for old definitions.
> v3: Fix constants.
> v2: Fix title.
> 
>  arch/sparc/include/uapi/asm/ioctls.h | 8 ++++----
>  1 file changed, 4 insertions(+), 4 deletions(-)
> 
> diff --git a/arch/sparc/include/uapi/asm/ioctls.h b/arch/sparc/include/uapi/asm/ioctls.h
> index 7fd2f5873c9e..a8bbdf9877a4 100644
> --- a/arch/sparc/include/uapi/asm/ioctls.h
> +++ b/arch/sparc/include/uapi/asm/ioctls.h
> @@ -5,10 +5,10 @@
>  #include <asm/ioctl.h>
>  
>  /* Big T */
> -#define TCGETA		_IOR('T', 1, struct termio)
> -#define TCSETA		_IOW('T', 2, struct termio)
> -#define TCSETAW		_IOW('T', 3, struct termio)
> -#define TCSETAF		_IOW('T', 4, struct termio)
> +#define TCGETA          0x40125401 /* _IOR('T', 1, struct termio) */
> +#define TCSETA          0x80125402 /* _IOW('T', 2, struct termio) */
> +#define TCSETAW         0x80125403 /* _IOW('T', 3, struct termio) */
> +#define TCSETAF         0x80125404 /* _IOW('T', 4, struct termio) */
>  #define TCSBRK		_IO('T', 5)
>  #define TCXONC		_IO('T', 6)
>  #define TCFLSH		_IO('T', 7)


Reviewed-by: Andreas Larsson <andreas@gaisler.com>

Picking this up to my for-next.

Thanks,
Andreas