From be413adedfca146a6fb8cabe3df1244a70f106f3 Mon Sep 17 00:00:00 2001 From: "H. Peter Anvin (Intel)" Date: Wed, 11 Jun 2025 18:35:43 -0700 Subject: [PATCH] termios: unify the naming of the termios speed fields The generic code has __ispeed and __ospeed; Linux has c_ispeed and c_ospeed. Use an anonymous union member to allow both set of names on all platforms. Reviewed-by: Adhemerval Zanella Signed-off-by: H. Peter Anvin (Intel) --- bits/termios.h | 11 ++++++++++- sysdeps/unix/sysv/linux/alpha/bits/termios-struct.h | 11 +++++++++-- sysdeps/unix/sysv/linux/bits/termios-struct.h | 11 +++++++++-- 3 files changed, 28 insertions(+), 5 deletions(-) diff --git a/bits/termios.h b/bits/termios.h index 8f0b817dbf..798012cb8e 100644 --- a/bits/termios.h +++ b/bits/termios.h @@ -286,7 +286,16 @@ struct termios cc_t c_cc[NCCS]; /* Input and output baud rates. */ - speed_t __ispeed, __ospeed; + __extension__ union { + speed_t __ispeed; + speed_t c_ispeed; + }; +#define _HAVE_STRUCT_TERMIOS_C_ISPEED 1 + __extension__ union { + speed_t __ospeed; + speed_t c_ospeed; + }; +#define _HAVE_STRUCT_TERMIOS_C_OSPEED 1 }; #define _IOT_termios /* Hurd ioctl type field. */ \ diff --git a/sysdeps/unix/sysv/linux/alpha/bits/termios-struct.h b/sysdeps/unix/sysv/linux/alpha/bits/termios-struct.h index de4d5fc0ed..f50e9ef6e3 100644 --- a/sysdeps/unix/sysv/linux/alpha/bits/termios-struct.h +++ b/sysdeps/unix/sysv/linux/alpha/bits/termios-struct.h @@ -30,8 +30,15 @@ struct termios tcflag_t c_lflag; /* local mode flags */ cc_t c_cc[NCCS]; /* control characters */ cc_t c_line; /* line discipline (== c_cc[33]) */ - speed_t c_ispeed; /* input speed */ - speed_t c_ospeed; /* output speed */ + /* Input and output baud rates. */ + __extension__ union { + speed_t __ispeed; + speed_t c_ispeed; + }; #define _HAVE_STRUCT_TERMIOS_C_ISPEED 1 + __extension__ union { + speed_t __ospeed; + speed_t c_ospeed; + }; #define _HAVE_STRUCT_TERMIOS_C_OSPEED 1 }; diff --git a/sysdeps/unix/sysv/linux/bits/termios-struct.h b/sysdeps/unix/sysv/linux/bits/termios-struct.h index 4c501a54b0..0aba1a446e 100644 --- a/sysdeps/unix/sysv/linux/bits/termios-struct.h +++ b/sysdeps/unix/sysv/linux/bits/termios-struct.h @@ -29,8 +29,15 @@ struct termios tcflag_t c_lflag; /* local mode flags */ cc_t c_line; /* line discipline */ cc_t c_cc[NCCS]; /* control characters */ - speed_t c_ispeed; /* input speed */ - speed_t c_ospeed; /* output speed */ + /* Input and output baud rates. */ + __extension__ union { + speed_t __ispeed; + speed_t c_ispeed; + }; #define _HAVE_STRUCT_TERMIOS_C_ISPEED 1 + __extension__ union { + speed_t __ospeed; + speed_t c_ospeed; + }; #define _HAVE_STRUCT_TERMIOS_C_OSPEED 1 };