[PATCH v5.2 10/12] termios: add new baud_t interface, defined to be explicitly numeric

H. Peter Anvin hpa@zytor.com
Tue May 27 22:08:44 GMT 2025


Add an explicitly numeric interface for baudrate setting. For glibc,
this only announces what is a fair accompli, but this is a plausible
way forward for standardization, and may be possible to infill on
non-compliant systems. The POSIX committee has stated:

[https://www.austingroupbugs.net/view.php?id=1916#c7135]

	A future version of this standard is expected to add at least
	the following symbolic constants for use as values of objects
	of type speed_t: B57600, B115200, B230400, B460800, and
	B921600.

	Implementations are encouraged to propose additional
	interfaces which will make it possible to set and query a
	wider range of speeds than just those enumerated by the
	constants beginning with B. If a set of common interfaces
	emerges between several implementations, a future version of
	this standard will likely add those interfaces.

This is exactly that interface.

The use of the term "baud" is due to the need to have a term
contrasting "speed", and it is already well established as a legacy
term -- including in the names of the legacy Bxxx
constants. Futhermore, it *is* valid from the point of view that the
termios interface fundamentally emulates an RS-232 serial port as far
as the application software is concerned.

Signed-off-by: H. Peter Anvin (Intel) <hpa@zytor.com>
---
 include/termios.h                             | 25 +++++-
 manual/terminal.texi                          | 87 ++++++++++++++++---
 sysdeps/mach/hurd/i386/libc.abilist           |  5 ++
 sysdeps/mach/hurd/x86_64/libc.abilist         |  5 ++
 sysdeps/unix/sysv/linux/aarch64/libc.abilist  |  5 ++
 sysdeps/unix/sysv/linux/alpha/libc.abilist    |  5 ++
 sysdeps/unix/sysv/linux/arc/libc.abilist      |  5 ++
 sysdeps/unix/sysv/linux/arm/be/libc.abilist   |  5 ++
 sysdeps/unix/sysv/linux/arm/le/libc.abilist   |  5 ++
 sysdeps/unix/sysv/linux/cfsetspeed.c          |  1 +
 sysdeps/unix/sysv/linux/csky/libc.abilist     |  5 ++
 sysdeps/unix/sysv/linux/hppa/libc.abilist     |  5 ++
 sysdeps/unix/sysv/linux/i386/libc.abilist     |  5 ++
 .../sysv/linux/loongarch/lp64/libc.abilist    |  5 ++
 .../sysv/linux/m68k/coldfire/libc.abilist     |  5 ++
 .../unix/sysv/linux/m68k/m680x0/libc.abilist  |  5 ++
 .../sysv/linux/microblaze/be/libc.abilist     |  5 ++
 .../sysv/linux/microblaze/le/libc.abilist     |  5 ++
 .../sysv/linux/mips/mips32/fpu/libc.abilist   |  5 ++
 .../sysv/linux/mips/mips32/nofpu/libc.abilist |  5 ++
 .../sysv/linux/mips/mips64/n32/libc.abilist   |  5 ++
 .../sysv/linux/mips/mips64/n64/libc.abilist   |  5 ++
 sysdeps/unix/sysv/linux/or1k/libc.abilist     |  5 ++
 .../linux/powerpc/powerpc32/fpu/libc.abilist  |  5 ++
 .../powerpc/powerpc32/nofpu/libc.abilist      |  5 ++
 .../linux/powerpc/powerpc64/be/libc.abilist   |  5 ++
 .../linux/powerpc/powerpc64/le/libc.abilist   |  5 ++
 .../unix/sysv/linux/riscv/rv32/libc.abilist   |  5 ++
 .../unix/sysv/linux/riscv/rv64/libc.abilist   |  5 ++
 .../unix/sysv/linux/s390/s390-32/libc.abilist |  5 ++
 .../unix/sysv/linux/s390/s390-64/libc.abilist |  5 ++
 sysdeps/unix/sysv/linux/sh/be/libc.abilist    |  5 ++
 sysdeps/unix/sysv/linux/sh/le/libc.abilist    |  5 ++
 .../sysv/linux/sparc/sparc32/libc.abilist     |  5 ++
 .../sysv/linux/sparc/sparc64/libc.abilist     |  5 ++
 sysdeps/unix/sysv/linux/speed.c               |  4 +
 .../unix/sysv/linux/x86_64/64/libc.abilist    |  5 ++
 .../unix/sysv/linux/x86_64/x32/libc.abilist   |  5 ++
 termios/Makefile                              |  3 +-
 termios/Versions                              |  4 +
 termios/baud.c                                | 56 ++++++++++++
 termios/cfsetbaud.c                           | 29 +++++++
 termios/cfsetspeed.c                          |  8 +-
 termios/speed.c                               | 18 ++--
 termios/termios.h                             | 19 +++-
 45 files changed, 397 insertions(+), 27 deletions(-)
 create mode 100644 termios/baud.c
 create mode 100644 termios/cfsetbaud.c

diff --git a/include/termios.h b/include/termios.h
index a79da7a1f379..d46608278fec 100644
--- a/include/termios.h
+++ b/include/termios.h
@@ -2,7 +2,18 @@
 #include <termios/termios.h>
 
 #ifndef _ISOMAC
-/* Now define the internal interfaces.  */
+extern speed_t __cfgetospeed (const struct termios *__termios_p);
+extern speed_t __cfgetispeed (const struct termios *__termios_p);
+extern int __cfsetospeed (struct termios *__termios_p, speed_t __speed);
+extern int __cfsetispeed (struct termios *__termios_p, speed_t __speed);
+extern int __cfsetspeed (struct termios *__termios_p, speed_t __speed);
+
+extern baud_t __cfgetobaud (const struct termios *__termios_p);
+extern baud_t __cfgetibaud (const struct termios *__termios_p);
+extern int __cfsetobaud (struct termios *__termios_p, baud_t __baud);
+extern int __cfsetibaud (struct termios *__termios_p, baud_t __baud);
+extern int __cfsetbaud (struct termios *__termios_p, baud_t __baud);
+
 extern int __tcgetattr (int __fd, struct termios *__termios_p);
 extern int __tcsetattr (int __fd, int __optional_actions,
 			const struct termios *__termios_p);
@@ -11,8 +22,16 @@ extern int __libc_tcdrain (int __fd);
 
 libc_hidden_proto (__tcgetattr)
 libc_hidden_proto (__tcsetattr)
-libc_hidden_proto (cfsetispeed)
-libc_hidden_proto (cfsetospeed)
+libc_hidden_proto (__cfgetispeed)
+libc_hidden_proto (__cfgetospeed)
+libc_hidden_proto (__cfsetispeed)
+libc_hidden_proto (__cfsetospeed)
+libc_hidden_proto (__cfsetspeed)
+libc_hidden_proto (__cfgetibaud)
+libc_hidden_proto (__cfgetobaud)
+libc_hidden_proto (__cfsetibaud)
+libc_hidden_proto (__cfsetobaud)
+libc_hidden_proto (__cfsetbaud)
 
 #endif
 #endif
diff --git a/manual/terminal.texi b/manual/terminal.texi
index 72d0282efdbc..fec239a8fb87 100644
--- a/manual/terminal.texi
+++ b/manual/terminal.texi
@@ -771,11 +771,11 @@ If this bit is set, it says to ignore the control modes and line speed
 values entirely.  This is only meaningful in a call to @code{tcsetattr}.
 
 The @code{c_cflag} member and the line speed values returned by
-@code{cfgetispeed} and @code{cfgetospeed} will be unaffected by the
-call.  @code{CIGNORE} is useful if you want to set all the software
-modes in the other members, but leave the hardware details in
-@code{c_cflag} unchanged.  (This is how the @code{TCSASOFT} flag to
-@code{tcsettattr} works.)
+@code{cfgetispeed}, @code{cfgetospeed}, @code{cfgetibaud} and
+@code{cfsetibaud} will be unaffected by the call.  @code{CIGNORE} is
+useful if you want to set all the software modes in the other members,
+but leave the hardware details in @code{c_cflag} unchanged.  (This is
+how the @code{TCSASOFT} flag to @code{tcsettattr} works.)
 
 This bit is never set in the structure filled in by @code{tcgetattr}.
 @end deftypevr
@@ -1047,14 +1047,15 @@ The @code{speed_t} type is an unsigned integer data type used to
 represent line speeds.
 @end deftp
 
-The functions @code{cfsetospeed} and @code{cfsetispeed} report errors
-only for speed values that the system simply cannot handle.  If you
-specify a speed value that is basically acceptable, then those functions
-will succeed.  But they do not check that a particular hardware device
-can actually support the specified speeds---in fact, they don't know
-which device you plan to set the speed for.  If you use @code{tcsetattr}
-to set the speed of a particular device to a value that it cannot
-handle, @code{tcsetattr} returns @math{-1}.
+@deftypefun speed_t cfgetospeed (const struct termios *@var{termios-p})
+@standards{POSIX.1, termios.h}
+@safety{@prelim{}@mtsafe{}@assafe{}@acsafe{}}
+@c Direct access to a single termios field, except on Linux, where
+@c multiple accesses may take place.  No worries either way, callers
+@c must ensure mutual exclusion on such non-opaque types.
+This function returns the output line speed stored in the structure
+@code{*@var{termios-p}}.
+@end deftypefun
 
 @strong{Portability note:} In @theglibc{}, the functions above
 accept speeds measured in bits per second as input, and return speed
@@ -1205,6 +1206,66 @@ BSD defines two additional speed symbols as aliases: @code{EXTA} is an
 alias for @code{B19200} and @code{EXTB} is an alias for @code{B38400}.
 These aliases are obsolete.
 
+@deftypefun baud_t cfgetibaud (const struct termios *@var{termios-p})
+@standards{GNU, termios.h}
+@safety{@prelim{}@mtsafe{}@assafe{}@acsafe{}}
+This function returns the input line baud rate stored in the structure
+@code{*@var{termios-p}}.
+@end deftypefun
+
+@deftypefun int cfsetobaud (struct termios *@var{termios-p}, baud_t @var{baud})
+@standards{GNU, termios.h}
+@safety{@prelim{}@mtsafe{}@assafe{}@acsafe{}}
+This function stores @var{baud} in @code{*@var{termios-p}} as the output
+baud rate.  The normal return value is @math{0}; a value of @math{-1}
+indicates an error.  If @var{baud} is not a valid baud rate, @code{cfsetobaud}
+returns @math{-1}.
+@end deftypefun
+
+@deftypefun int cfsetibaud (struct termios *@var{termios-p}, baud_t @var{baud})
+@standards{GNU, termios.h}
+@safety{@prelim{}@mtsafe{}@assafe{}@acsafe{}}
+This function stores @var{baud} in @code{*@var{termios-p}} as the input
+baud rate.  The normal return value is @math{0}; a value of @math{-1}
+indicates an error.  If @var{baud} is not a valid baud rate, @code{cfsetobaud}
+returns @math{-1}.
+@end deftypefun
+
+@deftypefun int cfsetbaud (struct termios *@var{termios-p}, baud_t @var{baud})
+@standards{GNU, termios.h}
+@safety{@prelim{}@mtsafe{}@assafe{}@acsafe{}}
+@c There's no guarantee that the two calls are atomic, but since this is
+@c not an opaque type, callers ought to ensure mutual exclusion to the
+@c termios object.
+
+@c cfsetbaud ok
+@c  cfsetibaud ok
+@c  cfsetobaud ok
+This function stores @var{baud} in @code{*@var{termios-p}} as both the
+input and output baud rates.  The normal return value is @math{0}; a value
+of @math{-1} indicates an error.  If @var{baud} is not a valid baud rate,
+@code{cfsetbaud} returns @math{-1}.
+@end deftypefun
+
+@deftp {Data Type} baud_t
+@standards{GNU}
+The @code{baud_t} type is an unsigned integer data type used to
+represent line baud rates. It will always represent the actual numeric
+value representing the baud rate, unlike @code{speed_t}. In @theglibc{}
+this is the same type as @code{speed_t}.
+@end deftp
+
+The functions @code{cfsetospeed}, @code{cfsetispeed}, @code{cfsetobaud}
+and @code{cfsetibaud} report errors only for speed values that the
+system simply cannot handle.  If you specify a speed value that is
+basically acceptable, then those functions will succeed.  But they do
+not check that a particular hardware device can actually support the
+specified speeds---in fact, they don't know which device you plan to set
+the speed for.  If you use @code{tcsetattr} to set the speed of a
+particular device to a value that it cannot handle, either @code{tcsetattr}
+returns @math{-1}, or the value is adjusted to the closest supported
+value, depending on the policy of the kernel driver.
+
 @node Special Characters
 @subsection Special Characters
 
diff --git a/sysdeps/mach/hurd/i386/libc.abilist b/sysdeps/mach/hurd/i386/libc.abilist
index 3e183f5c02ea..564d51c6f9b5 100644
--- a/sysdeps/mach/hurd/i386/libc.abilist
+++ b/sysdeps/mach/hurd/i386/libc.abilist
@@ -2586,6 +2586,11 @@ GLIBC_2.41 pthread_mutexattr_settype F
 GLIBC_2.41 pthread_sigmask F
 GLIBC_2.42 __inet_ntop_chk F
 GLIBC_2.42 __inet_pton_chk F
+GLIBC_2.42 cfgetibaud F
+GLIBC_2.42 cfgetobaud F
+GLIBC_2.42 cfsetbaud F
+GLIBC_2.42 cfsetibaud F
+GLIBC_2.42 cfsetobaud F
 GLIBC_2.42 pthread_barrier_destroy F
 GLIBC_2.42 pthread_barrier_init F
 GLIBC_2.42 pthread_barrier_wait F
diff --git a/sysdeps/mach/hurd/x86_64/libc.abilist b/sysdeps/mach/hurd/x86_64/libc.abilist
index 688ee26f4b25..a5e31ad4a021 100644
--- a/sysdeps/mach/hurd/x86_64/libc.abilist
+++ b/sysdeps/mach/hurd/x86_64/libc.abilist
@@ -2269,6 +2269,11 @@ GLIBC_2.41 pthread_mutexattr_settype F
 GLIBC_2.41 pthread_sigmask F
 GLIBC_2.42 __inet_ntop_chk F
 GLIBC_2.42 __inet_pton_chk F
+GLIBC_2.42 cfgetibaud F
+GLIBC_2.42 cfgetobaud F
+GLIBC_2.42 cfsetbaud F
+GLIBC_2.42 cfsetibaud F
+GLIBC_2.42 cfsetobaud F
 GLIBC_2.42 pthread_barrier_destroy F
 GLIBC_2.42 pthread_barrier_init F
 GLIBC_2.42 pthread_barrier_wait F
diff --git a/sysdeps/unix/sysv/linux/aarch64/libc.abilist b/sysdeps/unix/sysv/linux/aarch64/libc.abilist
index fdccf84d8f88..a22e65143209 100644
--- a/sysdeps/unix/sysv/linux/aarch64/libc.abilist
+++ b/sysdeps/unix/sysv/linux/aarch64/libc.abilist
@@ -2752,9 +2752,14 @@ GLIBC_2.41 sched_getattr F
 GLIBC_2.41 sched_setattr F
 GLIBC_2.42 __inet_ntop_chk F
 GLIBC_2.42 __inet_pton_chk F
+GLIBC_2.42 cfgetibaud F
 GLIBC_2.42 cfgetispeed F
+GLIBC_2.42 cfgetobaud F
 GLIBC_2.42 cfgetospeed F
+GLIBC_2.42 cfsetbaud F
+GLIBC_2.42 cfsetibaud F
 GLIBC_2.42 cfsetispeed F
+GLIBC_2.42 cfsetobaud F
 GLIBC_2.42 cfsetospeed F
 GLIBC_2.42 cfsetspeed F
 GLIBC_2.42 pthread_gettid_np F
diff --git a/sysdeps/unix/sysv/linux/alpha/libc.abilist b/sysdeps/unix/sysv/linux/alpha/libc.abilist
index 1e3f2781553e..4b5736a3b6d3 100644
--- a/sysdeps/unix/sysv/linux/alpha/libc.abilist
+++ b/sysdeps/unix/sysv/linux/alpha/libc.abilist
@@ -3099,9 +3099,14 @@ GLIBC_2.41 sched_getattr F
 GLIBC_2.41 sched_setattr F
 GLIBC_2.42 __inet_ntop_chk F
 GLIBC_2.42 __inet_pton_chk F
+GLIBC_2.42 cfgetibaud F
 GLIBC_2.42 cfgetispeed F
+GLIBC_2.42 cfgetobaud F
 GLIBC_2.42 cfgetospeed F
+GLIBC_2.42 cfsetbaud F
+GLIBC_2.42 cfsetibaud F
 GLIBC_2.42 cfsetispeed F
+GLIBC_2.42 cfsetobaud F
 GLIBC_2.42 cfsetospeed F
 GLIBC_2.42 cfsetspeed F
 GLIBC_2.42 pthread_gettid_np F
diff --git a/sysdeps/unix/sysv/linux/arc/libc.abilist b/sysdeps/unix/sysv/linux/arc/libc.abilist
index 7b7717d1d146..b8a44784bdc9 100644
--- a/sysdeps/unix/sysv/linux/arc/libc.abilist
+++ b/sysdeps/unix/sysv/linux/arc/libc.abilist
@@ -2513,9 +2513,14 @@ GLIBC_2.41 sched_getattr F
 GLIBC_2.41 sched_setattr F
 GLIBC_2.42 __inet_ntop_chk F
 GLIBC_2.42 __inet_pton_chk F
+GLIBC_2.42 cfgetibaud F
 GLIBC_2.42 cfgetispeed F
+GLIBC_2.42 cfgetobaud F
 GLIBC_2.42 cfgetospeed F
+GLIBC_2.42 cfsetbaud F
+GLIBC_2.42 cfsetibaud F
 GLIBC_2.42 cfsetispeed F
+GLIBC_2.42 cfsetobaud F
 GLIBC_2.42 cfsetospeed F
 GLIBC_2.42 cfsetspeed F
 GLIBC_2.42 pthread_gettid_np F
diff --git a/sysdeps/unix/sysv/linux/arm/be/libc.abilist b/sysdeps/unix/sysv/linux/arm/be/libc.abilist
index f64bf3f3278e..959e44672f2a 100644
--- a/sysdeps/unix/sysv/linux/arm/be/libc.abilist
+++ b/sysdeps/unix/sysv/linux/arm/be/libc.abilist
@@ -2805,9 +2805,14 @@ GLIBC_2.41 sched_getattr F
 GLIBC_2.41 sched_setattr F
 GLIBC_2.42 __inet_ntop_chk F
 GLIBC_2.42 __inet_pton_chk F
+GLIBC_2.42 cfgetibaud F
 GLIBC_2.42 cfgetispeed F
+GLIBC_2.42 cfgetobaud F
 GLIBC_2.42 cfgetospeed F
+GLIBC_2.42 cfsetbaud F
+GLIBC_2.42 cfsetibaud F
 GLIBC_2.42 cfsetispeed F
+GLIBC_2.42 cfsetobaud F
 GLIBC_2.42 cfsetospeed F
 GLIBC_2.42 cfsetspeed F
 GLIBC_2.42 pthread_gettid_np F
diff --git a/sysdeps/unix/sysv/linux/arm/le/libc.abilist b/sysdeps/unix/sysv/linux/arm/le/libc.abilist
index c065fe80fcd0..a930d1a52bbf 100644
--- a/sysdeps/unix/sysv/linux/arm/le/libc.abilist
+++ b/sysdeps/unix/sysv/linux/arm/le/libc.abilist
@@ -2802,9 +2802,14 @@ GLIBC_2.41 sched_getattr F
 GLIBC_2.41 sched_setattr F
 GLIBC_2.42 __inet_ntop_chk F
 GLIBC_2.42 __inet_pton_chk F
+GLIBC_2.42 cfgetibaud F
 GLIBC_2.42 cfgetispeed F
+GLIBC_2.42 cfgetobaud F
 GLIBC_2.42 cfgetospeed F
+GLIBC_2.42 cfsetbaud F
+GLIBC_2.42 cfsetibaud F
 GLIBC_2.42 cfsetispeed F
+GLIBC_2.42 cfsetobaud F
 GLIBC_2.42 cfsetospeed F
 GLIBC_2.42 cfsetspeed F
 GLIBC_2.42 pthread_gettid_np F
diff --git a/sysdeps/unix/sysv/linux/cfsetspeed.c b/sysdeps/unix/sysv/linux/cfsetspeed.c
index f350add35444..a4cab208ddf2 100644
--- a/sysdeps/unix/sysv/linux/cfsetspeed.c
+++ b/sysdeps/unix/sysv/linux/cfsetspeed.c
@@ -31,6 +31,7 @@ __cfsetspeed (struct termios *termios_p, speed_t speed)
 
   return 0;
 }
+libc_hidden_def (__cfsetspeed)
 versioned_symbol (libc, __cfsetspeed, cfsetspeed, GLIBC_2_42);
 
 #if _TERMIOS_OLD_COMPAT
diff --git a/sysdeps/unix/sysv/linux/csky/libc.abilist b/sysdeps/unix/sysv/linux/csky/libc.abilist
index 69ba60ea093e..6325fc12c4b4 100644
--- a/sysdeps/unix/sysv/linux/csky/libc.abilist
+++ b/sysdeps/unix/sysv/linux/csky/libc.abilist
@@ -2789,9 +2789,14 @@ GLIBC_2.41 sched_getattr F
 GLIBC_2.41 sched_setattr F
 GLIBC_2.42 __inet_ntop_chk F
 GLIBC_2.42 __inet_pton_chk F
+GLIBC_2.42 cfgetibaud F
 GLIBC_2.42 cfgetispeed F
+GLIBC_2.42 cfgetobaud F
 GLIBC_2.42 cfgetospeed F
+GLIBC_2.42 cfsetbaud F
+GLIBC_2.42 cfsetibaud F
 GLIBC_2.42 cfsetispeed F
+GLIBC_2.42 cfsetobaud F
 GLIBC_2.42 cfsetospeed F
 GLIBC_2.42 cfsetspeed F
 GLIBC_2.42 pthread_gettid_np F
diff --git a/sysdeps/unix/sysv/linux/hppa/libc.abilist b/sysdeps/unix/sysv/linux/hppa/libc.abilist
index dea7c09692bd..86b3fbdeec14 100644
--- a/sysdeps/unix/sysv/linux/hppa/libc.abilist
+++ b/sysdeps/unix/sysv/linux/hppa/libc.abilist
@@ -2826,9 +2826,14 @@ GLIBC_2.41 sched_getattr F
 GLIBC_2.41 sched_setattr F
 GLIBC_2.42 __inet_ntop_chk F
 GLIBC_2.42 __inet_pton_chk F
+GLIBC_2.42 cfgetibaud F
 GLIBC_2.42 cfgetispeed F
+GLIBC_2.42 cfgetobaud F
 GLIBC_2.42 cfgetospeed F
+GLIBC_2.42 cfsetbaud F
+GLIBC_2.42 cfsetibaud F
 GLIBC_2.42 cfsetispeed F
+GLIBC_2.42 cfsetobaud F
 GLIBC_2.42 cfsetospeed F
 GLIBC_2.42 cfsetspeed F
 GLIBC_2.42 pthread_gettid_np F
diff --git a/sysdeps/unix/sysv/linux/i386/libc.abilist b/sysdeps/unix/sysv/linux/i386/libc.abilist
index 4c05ab1c6e07..6555592d86d9 100644
--- a/sysdeps/unix/sysv/linux/i386/libc.abilist
+++ b/sysdeps/unix/sysv/linux/i386/libc.abilist
@@ -3009,9 +3009,14 @@ GLIBC_2.41 sched_getattr F
 GLIBC_2.41 sched_setattr F
 GLIBC_2.42 __inet_ntop_chk F
 GLIBC_2.42 __inet_pton_chk F
+GLIBC_2.42 cfgetibaud F
 GLIBC_2.42 cfgetispeed F
+GLIBC_2.42 cfgetobaud F
 GLIBC_2.42 cfgetospeed F
+GLIBC_2.42 cfsetbaud F
+GLIBC_2.42 cfsetibaud F
 GLIBC_2.42 cfsetispeed F
+GLIBC_2.42 cfsetobaud F
 GLIBC_2.42 cfsetospeed F
 GLIBC_2.42 cfsetspeed F
 GLIBC_2.42 pthread_gettid_np F
diff --git a/sysdeps/unix/sysv/linux/loongarch/lp64/libc.abilist b/sysdeps/unix/sysv/linux/loongarch/lp64/libc.abilist
index 6ab4968d17ce..a6cab9612a4c 100644
--- a/sysdeps/unix/sysv/linux/loongarch/lp64/libc.abilist
+++ b/sysdeps/unix/sysv/linux/loongarch/lp64/libc.abilist
@@ -2273,9 +2273,14 @@ GLIBC_2.41 sched_getattr F
 GLIBC_2.41 sched_setattr F
 GLIBC_2.42 __inet_ntop_chk F
 GLIBC_2.42 __inet_pton_chk F
+GLIBC_2.42 cfgetibaud F
 GLIBC_2.42 cfgetispeed F
+GLIBC_2.42 cfgetobaud F
 GLIBC_2.42 cfgetospeed F
+GLIBC_2.42 cfsetbaud F
+GLIBC_2.42 cfsetibaud F
 GLIBC_2.42 cfsetispeed F
+GLIBC_2.42 cfsetobaud F
 GLIBC_2.42 cfsetospeed F
 GLIBC_2.42 cfsetspeed F
 GLIBC_2.42 pthread_gettid_np F
diff --git a/sysdeps/unix/sysv/linux/m68k/coldfire/libc.abilist b/sysdeps/unix/sysv/linux/m68k/coldfire/libc.abilist
index e553bdc8a3b0..7b7b72aa50f8 100644
--- a/sysdeps/unix/sysv/linux/m68k/coldfire/libc.abilist
+++ b/sysdeps/unix/sysv/linux/m68k/coldfire/libc.abilist
@@ -2785,9 +2785,14 @@ GLIBC_2.41 sched_getattr F
 GLIBC_2.41 sched_setattr F
 GLIBC_2.42 __inet_ntop_chk F
 GLIBC_2.42 __inet_pton_chk F
+GLIBC_2.42 cfgetibaud F
 GLIBC_2.42 cfgetispeed F
+GLIBC_2.42 cfgetobaud F
 GLIBC_2.42 cfgetospeed F
+GLIBC_2.42 cfsetbaud F
+GLIBC_2.42 cfsetibaud F
 GLIBC_2.42 cfsetispeed F
+GLIBC_2.42 cfsetobaud F
 GLIBC_2.42 cfsetospeed F
 GLIBC_2.42 cfsetspeed F
 GLIBC_2.42 pthread_gettid_np F
diff --git a/sysdeps/unix/sysv/linux/m68k/m680x0/libc.abilist b/sysdeps/unix/sysv/linux/m68k/m680x0/libc.abilist
index 1239f0d7a029..df398e43c62d 100644
--- a/sysdeps/unix/sysv/linux/m68k/m680x0/libc.abilist
+++ b/sysdeps/unix/sysv/linux/m68k/m680x0/libc.abilist
@@ -2952,9 +2952,14 @@ GLIBC_2.41 sched_getattr F
 GLIBC_2.41 sched_setattr F
 GLIBC_2.42 __inet_ntop_chk F
 GLIBC_2.42 __inet_pton_chk F
+GLIBC_2.42 cfgetibaud F
 GLIBC_2.42 cfgetispeed F
+GLIBC_2.42 cfgetobaud F
 GLIBC_2.42 cfgetospeed F
+GLIBC_2.42 cfsetbaud F
+GLIBC_2.42 cfsetibaud F
 GLIBC_2.42 cfsetispeed F
+GLIBC_2.42 cfsetobaud F
 GLIBC_2.42 cfsetospeed F
 GLIBC_2.42 cfsetspeed F
 GLIBC_2.42 pthread_gettid_np F
diff --git a/sysdeps/unix/sysv/linux/microblaze/be/libc.abilist b/sysdeps/unix/sysv/linux/microblaze/be/libc.abilist
index 943e89a45fd4..ca8df6f4b0c1 100644
--- a/sysdeps/unix/sysv/linux/microblaze/be/libc.abilist
+++ b/sysdeps/unix/sysv/linux/microblaze/be/libc.abilist
@@ -2838,9 +2838,14 @@ GLIBC_2.41 sched_getattr F
 GLIBC_2.41 sched_setattr F
 GLIBC_2.42 __inet_ntop_chk F
 GLIBC_2.42 __inet_pton_chk F
+GLIBC_2.42 cfgetibaud F
 GLIBC_2.42 cfgetispeed F
+GLIBC_2.42 cfgetobaud F
 GLIBC_2.42 cfgetospeed F
+GLIBC_2.42 cfsetbaud F
+GLIBC_2.42 cfsetibaud F
 GLIBC_2.42 cfsetispeed F
+GLIBC_2.42 cfsetobaud F
 GLIBC_2.42 cfsetospeed F
 GLIBC_2.42 cfsetspeed F
 GLIBC_2.42 pthread_gettid_np F
diff --git a/sysdeps/unix/sysv/linux/microblaze/le/libc.abilist b/sysdeps/unix/sysv/linux/microblaze/le/libc.abilist
index 9c303d9d9aa8..950815484752 100644
--- a/sysdeps/unix/sysv/linux/microblaze/le/libc.abilist
+++ b/sysdeps/unix/sysv/linux/microblaze/le/libc.abilist
@@ -2835,9 +2835,14 @@ GLIBC_2.41 sched_getattr F
 GLIBC_2.41 sched_setattr F
 GLIBC_2.42 __inet_ntop_chk F
 GLIBC_2.42 __inet_pton_chk F
+GLIBC_2.42 cfgetibaud F
 GLIBC_2.42 cfgetispeed F
+GLIBC_2.42 cfgetobaud F
 GLIBC_2.42 cfgetospeed F
+GLIBC_2.42 cfsetbaud F
+GLIBC_2.42 cfsetibaud F
 GLIBC_2.42 cfsetispeed F
+GLIBC_2.42 cfsetobaud F
 GLIBC_2.42 cfsetospeed F
 GLIBC_2.42 cfsetspeed F
 GLIBC_2.42 pthread_gettid_np F
diff --git a/sysdeps/unix/sysv/linux/mips/mips32/fpu/libc.abilist b/sysdeps/unix/sysv/linux/mips/mips32/fpu/libc.abilist
index 6eb6fd476b0d..4d51cc428f15 100644
--- a/sysdeps/unix/sysv/linux/mips/mips32/fpu/libc.abilist
+++ b/sysdeps/unix/sysv/linux/mips/mips32/fpu/libc.abilist
@@ -2913,9 +2913,14 @@ GLIBC_2.41 sched_getattr F
 GLIBC_2.41 sched_setattr F
 GLIBC_2.42 __inet_ntop_chk F
 GLIBC_2.42 __inet_pton_chk F
+GLIBC_2.42 cfgetibaud F
 GLIBC_2.42 cfgetispeed F
+GLIBC_2.42 cfgetobaud F
 GLIBC_2.42 cfgetospeed F
+GLIBC_2.42 cfsetbaud F
+GLIBC_2.42 cfsetibaud F
 GLIBC_2.42 cfsetispeed F
+GLIBC_2.42 cfsetobaud F
 GLIBC_2.42 cfsetospeed F
 GLIBC_2.42 cfsetspeed F
 GLIBC_2.42 pthread_gettid_np F
diff --git a/sysdeps/unix/sysv/linux/mips/mips32/nofpu/libc.abilist b/sysdeps/unix/sysv/linux/mips/mips32/nofpu/libc.abilist
index 58a43bb9b3d3..7f90fadc76ec 100644
--- a/sysdeps/unix/sysv/linux/mips/mips32/nofpu/libc.abilist
+++ b/sysdeps/unix/sysv/linux/mips/mips32/nofpu/libc.abilist
@@ -2911,9 +2911,14 @@ GLIBC_2.41 sched_getattr F
 GLIBC_2.41 sched_setattr F
 GLIBC_2.42 __inet_ntop_chk F
 GLIBC_2.42 __inet_pton_chk F
+GLIBC_2.42 cfgetibaud F
 GLIBC_2.42 cfgetispeed F
+GLIBC_2.42 cfgetobaud F
 GLIBC_2.42 cfgetospeed F
+GLIBC_2.42 cfsetbaud F
+GLIBC_2.42 cfsetibaud F
 GLIBC_2.42 cfsetispeed F
+GLIBC_2.42 cfsetobaud F
 GLIBC_2.42 cfsetospeed F
 GLIBC_2.42 cfsetspeed F
 GLIBC_2.42 pthread_gettid_np F
diff --git a/sysdeps/unix/sysv/linux/mips/mips64/n32/libc.abilist b/sysdeps/unix/sysv/linux/mips/mips64/n32/libc.abilist
index abab2ad80758..fc366d1bd0de 100644
--- a/sysdeps/unix/sysv/linux/mips/mips64/n32/libc.abilist
+++ b/sysdeps/unix/sysv/linux/mips/mips64/n32/libc.abilist
@@ -2919,9 +2919,14 @@ GLIBC_2.41 sched_getattr F
 GLIBC_2.41 sched_setattr F
 GLIBC_2.42 __inet_ntop_chk F
 GLIBC_2.42 __inet_pton_chk F
+GLIBC_2.42 cfgetibaud F
 GLIBC_2.42 cfgetispeed F
+GLIBC_2.42 cfgetobaud F
 GLIBC_2.42 cfgetospeed F
+GLIBC_2.42 cfsetbaud F
+GLIBC_2.42 cfsetibaud F
 GLIBC_2.42 cfsetispeed F
+GLIBC_2.42 cfsetobaud F
 GLIBC_2.42 cfsetospeed F
 GLIBC_2.42 cfsetspeed F
 GLIBC_2.42 pthread_gettid_np F
diff --git a/sysdeps/unix/sysv/linux/mips/mips64/n64/libc.abilist b/sysdeps/unix/sysv/linux/mips/mips64/n64/libc.abilist
index 2e31f6eed6b7..debd5c37c9af 100644
--- a/sysdeps/unix/sysv/linux/mips/mips64/n64/libc.abilist
+++ b/sysdeps/unix/sysv/linux/mips/mips64/n64/libc.abilist
@@ -2821,9 +2821,14 @@ GLIBC_2.41 sched_getattr F
 GLIBC_2.41 sched_setattr F
 GLIBC_2.42 __inet_ntop_chk F
 GLIBC_2.42 __inet_pton_chk F
+GLIBC_2.42 cfgetibaud F
 GLIBC_2.42 cfgetispeed F
+GLIBC_2.42 cfgetobaud F
 GLIBC_2.42 cfgetospeed F
+GLIBC_2.42 cfsetbaud F
+GLIBC_2.42 cfsetibaud F
 GLIBC_2.42 cfsetispeed F
+GLIBC_2.42 cfsetobaud F
 GLIBC_2.42 cfsetospeed F
 GLIBC_2.42 cfsetspeed F
 GLIBC_2.42 pthread_gettid_np F
diff --git a/sysdeps/unix/sysv/linux/or1k/libc.abilist b/sysdeps/unix/sysv/linux/or1k/libc.abilist
index b54c078b520c..b62d59f1afe9 100644
--- a/sysdeps/unix/sysv/linux/or1k/libc.abilist
+++ b/sysdeps/unix/sysv/linux/or1k/libc.abilist
@@ -2263,9 +2263,14 @@ GLIBC_2.41 sched_getattr F
 GLIBC_2.41 sched_setattr F
 GLIBC_2.42 __inet_ntop_chk F
 GLIBC_2.42 __inet_pton_chk F
+GLIBC_2.42 cfgetibaud F
 GLIBC_2.42 cfgetispeed F
+GLIBC_2.42 cfgetobaud F
 GLIBC_2.42 cfgetospeed F
+GLIBC_2.42 cfsetbaud F
+GLIBC_2.42 cfsetibaud F
 GLIBC_2.42 cfsetispeed F
+GLIBC_2.42 cfsetobaud F
 GLIBC_2.42 cfsetospeed F
 GLIBC_2.42 cfsetspeed F
 GLIBC_2.42 pthread_gettid_np F
diff --git a/sysdeps/unix/sysv/linux/powerpc/powerpc32/fpu/libc.abilist b/sysdeps/unix/sysv/linux/powerpc/powerpc32/fpu/libc.abilist
index c30e17cdfca2..883e66f3ae6a 100644
--- a/sysdeps/unix/sysv/linux/powerpc/powerpc32/fpu/libc.abilist
+++ b/sysdeps/unix/sysv/linux/powerpc/powerpc32/fpu/libc.abilist
@@ -3142,9 +3142,14 @@ GLIBC_2.41 sched_getattr F
 GLIBC_2.41 sched_setattr F
 GLIBC_2.42 __inet_ntop_chk F
 GLIBC_2.42 __inet_pton_chk F
+GLIBC_2.42 cfgetibaud F
 GLIBC_2.42 cfgetispeed F
+GLIBC_2.42 cfgetobaud F
 GLIBC_2.42 cfgetospeed F
+GLIBC_2.42 cfsetbaud F
+GLIBC_2.42 cfsetibaud F
 GLIBC_2.42 cfsetispeed F
+GLIBC_2.42 cfsetobaud F
 GLIBC_2.42 cfsetospeed F
 GLIBC_2.42 cfsetspeed F
 GLIBC_2.42 pthread_gettid_np F
diff --git a/sysdeps/unix/sysv/linux/powerpc/powerpc32/nofpu/libc.abilist b/sysdeps/unix/sysv/linux/powerpc/powerpc32/nofpu/libc.abilist
index f3c0c0205249..84cd9e0e18c7 100644
--- a/sysdeps/unix/sysv/linux/powerpc/powerpc32/nofpu/libc.abilist
+++ b/sysdeps/unix/sysv/linux/powerpc/powerpc32/nofpu/libc.abilist
@@ -3187,9 +3187,14 @@ GLIBC_2.41 sched_getattr F
 GLIBC_2.41 sched_setattr F
 GLIBC_2.42 __inet_ntop_chk F
 GLIBC_2.42 __inet_pton_chk F
+GLIBC_2.42 cfgetibaud F
 GLIBC_2.42 cfgetispeed F
+GLIBC_2.42 cfgetobaud F
 GLIBC_2.42 cfgetospeed F
+GLIBC_2.42 cfsetbaud F
+GLIBC_2.42 cfsetibaud F
 GLIBC_2.42 cfsetispeed F
+GLIBC_2.42 cfsetobaud F
 GLIBC_2.42 cfsetospeed F
 GLIBC_2.42 cfsetspeed F
 GLIBC_2.42 pthread_gettid_np F
diff --git a/sysdeps/unix/sysv/linux/powerpc/powerpc64/be/libc.abilist b/sysdeps/unix/sysv/linux/powerpc/powerpc64/be/libc.abilist
index 6e1d141ca7fd..8832568ab3bf 100644
--- a/sysdeps/unix/sysv/linux/powerpc/powerpc64/be/libc.abilist
+++ b/sysdeps/unix/sysv/linux/powerpc/powerpc64/be/libc.abilist
@@ -2896,9 +2896,14 @@ GLIBC_2.41 sched_getattr F
 GLIBC_2.41 sched_setattr F
 GLIBC_2.42 __inet_ntop_chk F
 GLIBC_2.42 __inet_pton_chk F
+GLIBC_2.42 cfgetibaud F
 GLIBC_2.42 cfgetispeed F
+GLIBC_2.42 cfgetobaud F
 GLIBC_2.42 cfgetospeed F
+GLIBC_2.42 cfsetbaud F
+GLIBC_2.42 cfsetibaud F
 GLIBC_2.42 cfsetispeed F
+GLIBC_2.42 cfsetobaud F
 GLIBC_2.42 cfsetospeed F
 GLIBC_2.42 cfsetspeed F
 GLIBC_2.42 pthread_gettid_np F
diff --git a/sysdeps/unix/sysv/linux/powerpc/powerpc64/le/libc.abilist b/sysdeps/unix/sysv/linux/powerpc/powerpc64/le/libc.abilist
index 441296c7e8ba..b6ff8016e4b3 100644
--- a/sysdeps/unix/sysv/linux/powerpc/powerpc64/le/libc.abilist
+++ b/sysdeps/unix/sysv/linux/powerpc/powerpc64/le/libc.abilist
@@ -2972,9 +2972,14 @@ GLIBC_2.41 sched_getattr F
 GLIBC_2.41 sched_setattr F
 GLIBC_2.42 __inet_ntop_chk F
 GLIBC_2.42 __inet_pton_chk F
+GLIBC_2.42 cfgetibaud F
 GLIBC_2.42 cfgetispeed F
+GLIBC_2.42 cfgetobaud F
 GLIBC_2.42 cfgetospeed F
+GLIBC_2.42 cfsetbaud F
+GLIBC_2.42 cfsetibaud F
 GLIBC_2.42 cfsetispeed F
+GLIBC_2.42 cfsetobaud F
 GLIBC_2.42 cfsetospeed F
 GLIBC_2.42 cfsetspeed F
 GLIBC_2.42 pthread_gettid_np F
diff --git a/sysdeps/unix/sysv/linux/riscv/rv32/libc.abilist b/sysdeps/unix/sysv/linux/riscv/rv32/libc.abilist
index bcc0ed8d6a5f..1771a2370c5a 100644
--- a/sysdeps/unix/sysv/linux/riscv/rv32/libc.abilist
+++ b/sysdeps/unix/sysv/linux/riscv/rv32/libc.abilist
@@ -2516,9 +2516,14 @@ GLIBC_2.41 sched_getattr F
 GLIBC_2.41 sched_setattr F
 GLIBC_2.42 __inet_ntop_chk F
 GLIBC_2.42 __inet_pton_chk F
+GLIBC_2.42 cfgetibaud F
 GLIBC_2.42 cfgetispeed F
+GLIBC_2.42 cfgetobaud F
 GLIBC_2.42 cfgetospeed F
+GLIBC_2.42 cfsetbaud F
+GLIBC_2.42 cfsetibaud F
 GLIBC_2.42 cfsetispeed F
+GLIBC_2.42 cfsetobaud F
 GLIBC_2.42 cfsetospeed F
 GLIBC_2.42 cfsetspeed F
 GLIBC_2.42 pthread_gettid_np F
diff --git a/sysdeps/unix/sysv/linux/riscv/rv64/libc.abilist b/sysdeps/unix/sysv/linux/riscv/rv64/libc.abilist
index d55b553c0e39..4b48352fd99b 100644
--- a/sysdeps/unix/sysv/linux/riscv/rv64/libc.abilist
+++ b/sysdeps/unix/sysv/linux/riscv/rv64/libc.abilist
@@ -2716,9 +2716,14 @@ GLIBC_2.41 sched_getattr F
 GLIBC_2.41 sched_setattr F
 GLIBC_2.42 __inet_ntop_chk F
 GLIBC_2.42 __inet_pton_chk F
+GLIBC_2.42 cfgetibaud F
 GLIBC_2.42 cfgetispeed F
+GLIBC_2.42 cfgetobaud F
 GLIBC_2.42 cfgetospeed F
+GLIBC_2.42 cfsetbaud F
+GLIBC_2.42 cfsetibaud F
 GLIBC_2.42 cfsetispeed F
+GLIBC_2.42 cfsetobaud F
 GLIBC_2.42 cfsetospeed F
 GLIBC_2.42 cfsetspeed F
 GLIBC_2.42 pthread_gettid_np F
diff --git a/sysdeps/unix/sysv/linux/s390/s390-32/libc.abilist b/sysdeps/unix/sysv/linux/s390/s390-32/libc.abilist
index a45b8874f0a3..f0decc787bab 100644
--- a/sysdeps/unix/sysv/linux/s390/s390-32/libc.abilist
+++ b/sysdeps/unix/sysv/linux/s390/s390-32/libc.abilist
@@ -3140,9 +3140,14 @@ GLIBC_2.41 sched_getattr F
 GLIBC_2.41 sched_setattr F
 GLIBC_2.42 __inet_ntop_chk F
 GLIBC_2.42 __inet_pton_chk F
+GLIBC_2.42 cfgetibaud F
 GLIBC_2.42 cfgetispeed F
+GLIBC_2.42 cfgetobaud F
 GLIBC_2.42 cfgetospeed F
+GLIBC_2.42 cfsetbaud F
+GLIBC_2.42 cfsetibaud F
 GLIBC_2.42 cfsetispeed F
+GLIBC_2.42 cfsetobaud F
 GLIBC_2.42 cfsetospeed F
 GLIBC_2.42 cfsetspeed F
 GLIBC_2.42 pthread_gettid_np F
diff --git a/sysdeps/unix/sysv/linux/s390/s390-64/libc.abilist b/sysdeps/unix/sysv/linux/s390/s390-64/libc.abilist
index 17483dcc4895..da8a2bfb74aa 100644
--- a/sysdeps/unix/sysv/linux/s390/s390-64/libc.abilist
+++ b/sysdeps/unix/sysv/linux/s390/s390-64/libc.abilist
@@ -2933,9 +2933,14 @@ GLIBC_2.41 sched_getattr F
 GLIBC_2.41 sched_setattr F
 GLIBC_2.42 __inet_ntop_chk F
 GLIBC_2.42 __inet_pton_chk F
+GLIBC_2.42 cfgetibaud F
 GLIBC_2.42 cfgetispeed F
+GLIBC_2.42 cfgetobaud F
 GLIBC_2.42 cfgetospeed F
+GLIBC_2.42 cfsetbaud F
+GLIBC_2.42 cfsetibaud F
 GLIBC_2.42 cfsetispeed F
+GLIBC_2.42 cfsetobaud F
 GLIBC_2.42 cfsetospeed F
 GLIBC_2.42 cfsetspeed F
 GLIBC_2.42 pthread_gettid_np F
diff --git a/sysdeps/unix/sysv/linux/sh/be/libc.abilist b/sysdeps/unix/sysv/linux/sh/be/libc.abilist
index cb62b6e083eb..fb303418946b 100644
--- a/sysdeps/unix/sysv/linux/sh/be/libc.abilist
+++ b/sysdeps/unix/sysv/linux/sh/be/libc.abilist
@@ -2832,9 +2832,14 @@ GLIBC_2.41 sched_getattr F
 GLIBC_2.41 sched_setattr F
 GLIBC_2.42 __inet_ntop_chk F
 GLIBC_2.42 __inet_pton_chk F
+GLIBC_2.42 cfgetibaud F
 GLIBC_2.42 cfgetispeed F
+GLIBC_2.42 cfgetobaud F
 GLIBC_2.42 cfgetospeed F
+GLIBC_2.42 cfsetbaud F
+GLIBC_2.42 cfsetibaud F
 GLIBC_2.42 cfsetispeed F
+GLIBC_2.42 cfsetobaud F
 GLIBC_2.42 cfsetospeed F
 GLIBC_2.42 cfsetspeed F
 GLIBC_2.42 pthread_gettid_np F
diff --git a/sysdeps/unix/sysv/linux/sh/le/libc.abilist b/sysdeps/unix/sysv/linux/sh/le/libc.abilist
index ee6f2d017073..d71667343278 100644
--- a/sysdeps/unix/sysv/linux/sh/le/libc.abilist
+++ b/sysdeps/unix/sysv/linux/sh/le/libc.abilist
@@ -2829,9 +2829,14 @@ GLIBC_2.41 sched_getattr F
 GLIBC_2.41 sched_setattr F
 GLIBC_2.42 __inet_ntop_chk F
 GLIBC_2.42 __inet_pton_chk F
+GLIBC_2.42 cfgetibaud F
 GLIBC_2.42 cfgetispeed F
+GLIBC_2.42 cfgetobaud F
 GLIBC_2.42 cfgetospeed F
+GLIBC_2.42 cfsetbaud F
+GLIBC_2.42 cfsetibaud F
 GLIBC_2.42 cfsetispeed F
+GLIBC_2.42 cfsetobaud F
 GLIBC_2.42 cfsetospeed F
 GLIBC_2.42 cfsetspeed F
 GLIBC_2.42 pthread_gettid_np F
diff --git a/sysdeps/unix/sysv/linux/sparc/sparc32/libc.abilist b/sysdeps/unix/sysv/linux/sparc/sparc32/libc.abilist
index 943e130d3a8a..6deedf216dbe 100644
--- a/sysdeps/unix/sysv/linux/sparc/sparc32/libc.abilist
+++ b/sysdeps/unix/sysv/linux/sparc/sparc32/libc.abilist
@@ -3161,9 +3161,14 @@ GLIBC_2.41 sched_getattr F
 GLIBC_2.41 sched_setattr F
 GLIBC_2.42 __inet_ntop_chk F
 GLIBC_2.42 __inet_pton_chk F
+GLIBC_2.42 cfgetibaud F
 GLIBC_2.42 cfgetispeed F
+GLIBC_2.42 cfgetobaud F
 GLIBC_2.42 cfgetospeed F
+GLIBC_2.42 cfsetbaud F
+GLIBC_2.42 cfsetibaud F
 GLIBC_2.42 cfsetispeed F
+GLIBC_2.42 cfsetobaud F
 GLIBC_2.42 cfsetospeed F
 GLIBC_2.42 cfsetspeed F
 GLIBC_2.42 pthread_gettid_np F
diff --git a/sysdeps/unix/sysv/linux/sparc/sparc64/libc.abilist b/sysdeps/unix/sysv/linux/sparc/sparc64/libc.abilist
index 1017babb1d59..1ce22bf036b7 100644
--- a/sysdeps/unix/sysv/linux/sparc/sparc64/libc.abilist
+++ b/sysdeps/unix/sysv/linux/sparc/sparc64/libc.abilist
@@ -2797,9 +2797,14 @@ GLIBC_2.41 sched_getattr F
 GLIBC_2.41 sched_setattr F
 GLIBC_2.42 __inet_ntop_chk F
 GLIBC_2.42 __inet_pton_chk F
+GLIBC_2.42 cfgetibaud F
 GLIBC_2.42 cfgetispeed F
+GLIBC_2.42 cfgetobaud F
 GLIBC_2.42 cfgetospeed F
+GLIBC_2.42 cfsetbaud F
+GLIBC_2.42 cfsetibaud F
 GLIBC_2.42 cfsetispeed F
+GLIBC_2.42 cfsetobaud F
 GLIBC_2.42 cfsetospeed F
 GLIBC_2.42 cfsetspeed F
 GLIBC_2.42 pthread_gettid_np F
diff --git a/sysdeps/unix/sysv/linux/speed.c b/sysdeps/unix/sysv/linux/speed.c
index 75879e681aee..fcada7f63270 100644
--- a/sysdeps/unix/sysv/linux/speed.c
+++ b/sysdeps/unix/sysv/linux/speed.c
@@ -252,6 +252,7 @@ __cfgetospeed (const struct termios *termios_p)
 {
   return termios_p->c_ospeed;
 }
+libc_hidden_def (__cfgetospeed)
 versioned_symbol (libc, __cfgetospeed, cfgetospeed, GLIBC_2_42);
 
 /* Return the input baud rate stored in *TERMIOS_P.  */
@@ -260,6 +261,7 @@ __cfgetispeed (const struct termios *termios_p)
 {
   return termios_p->c_ispeed;
 }
+libc_hidden_def (__cfgetispeed)
 versioned_symbol (libc, __cfgetispeed, cfgetispeed, GLIBC_2_42);
 
 /* Set the output baud rate stored in *TERMIOS_P to SPEED.  */
@@ -274,6 +276,7 @@ __cfsetospeed (struct termios *termios_p, speed_t speed)
 
   return 0;
 }
+libc_hidden_def (__cfsetospeed)
 versioned_symbol (libc, __cfsetospeed, cfsetospeed, GLIBC_2_42);
 
 /* Set the input baud rate stored in *TERMIOS_P to SPEED. */
@@ -288,6 +291,7 @@ __cfsetispeed (struct termios *termios_p, speed_t speed)
 
   return 0;
 }
+libc_hidden_def (__cfsetispeed)
 versioned_symbol (libc, __cfsetispeed, cfsetispeed, GLIBC_2_42);
 
 #if _TERMIOS_OLD_COMPAT
diff --git a/sysdeps/unix/sysv/linux/x86_64/64/libc.abilist b/sysdeps/unix/sysv/linux/x86_64/64/libc.abilist
index ccf6ca2c8876..564877250b25 100644
--- a/sysdeps/unix/sysv/linux/x86_64/64/libc.abilist
+++ b/sysdeps/unix/sysv/linux/x86_64/64/libc.abilist
@@ -2748,9 +2748,14 @@ GLIBC_2.41 sched_getattr F
 GLIBC_2.41 sched_setattr F
 GLIBC_2.42 __inet_ntop_chk F
 GLIBC_2.42 __inet_pton_chk F
+GLIBC_2.42 cfgetibaud F
 GLIBC_2.42 cfgetispeed F
+GLIBC_2.42 cfgetobaud F
 GLIBC_2.42 cfgetospeed F
+GLIBC_2.42 cfsetbaud F
+GLIBC_2.42 cfsetibaud F
 GLIBC_2.42 cfsetispeed F
+GLIBC_2.42 cfsetobaud F
 GLIBC_2.42 cfsetospeed F
 GLIBC_2.42 cfsetspeed F
 GLIBC_2.42 pthread_gettid_np F
diff --git a/sysdeps/unix/sysv/linux/x86_64/x32/libc.abilist b/sysdeps/unix/sysv/linux/x86_64/x32/libc.abilist
index 1e3e283954d5..25a39d094342 100644
--- a/sysdeps/unix/sysv/linux/x86_64/x32/libc.abilist
+++ b/sysdeps/unix/sysv/linux/x86_64/x32/libc.abilist
@@ -2767,9 +2767,14 @@ GLIBC_2.41 sched_getattr F
 GLIBC_2.41 sched_setattr F
 GLIBC_2.42 __inet_ntop_chk F
 GLIBC_2.42 __inet_pton_chk F
+GLIBC_2.42 cfgetibaud F
 GLIBC_2.42 cfgetispeed F
+GLIBC_2.42 cfgetobaud F
 GLIBC_2.42 cfgetospeed F
+GLIBC_2.42 cfsetbaud F
+GLIBC_2.42 cfsetibaud F
 GLIBC_2.42 cfsetispeed F
+GLIBC_2.42 cfsetobaud F
 GLIBC_2.42 cfsetospeed F
 GLIBC_2.42 cfsetspeed F
 GLIBC_2.42 pthread_gettid_np F
diff --git a/termios/Makefile b/termios/Makefile
index 43235346f2db..7dc3830ab6ef 100644
--- a/termios/Makefile
+++ b/termios/Makefile
@@ -26,7 +26,8 @@ headers	:= termios.h bits/termios.h bits/termios-baud.h \
 	   sys/ttydefaults.h sys/termios.h sys/ttychars.h
 
 routines	:= speed cfsetspeed tcsetattr tcgetattr tcgetpgrp tcsetpgrp \
-		   tcdrain tcflow tcflush tcsendbrk cfmakeraw tcgetsid
+		   tcdrain tcflow tcflush tcsendbrk cfmakeraw tcgetsid \
+		   baud cfsetbaud
 
 include ../Rules
 
diff --git a/termios/Versions b/termios/Versions
index 711ed0334b52..a5eec8325753 100644
--- a/termios/Versions
+++ b/termios/Versions
@@ -11,4 +11,8 @@ libc {
     # t*
     tcgetsid;
   }
+  GLIBC_2.42 {
+    # cf*baud
+    cfgetibaud; cfgetobaud; cfsetibaud; cfsetobaud; cfsetbaud;
+  }
 }
diff --git a/termios/baud.c b/termios/baud.c
new file mode 100644
index 000000000000..27c06e937fdb
--- /dev/null
+++ b/termios/baud.c
@@ -0,0 +1,56 @@
+/* `struct termios' speed frobnication functions, baud rate wrappers.
+   Any platform which doesn't have Bxxx == xxx for all baud rate
+   constants will need to override this file.
+
+   Copyright (C) 1991-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/>.  */
+
+#include <stddef.h>
+#include <errno.h>
+#include <termios.h>
+
+baud_t
+__cfgetobaud (const struct termios *termios_p)
+{
+  return __cfgetospeed (termios_p);
+}
+libc_hidden_def (__cfgetobaud)
+weak_alias (__cfgetobaud, cfgetobaud)
+
+baud_t
+__cfgetibaud (const struct termios *termios_p)
+{
+  return __cfgetispeed (termios_p);
+}
+libc_hidden_def (__cfgetibaud)
+weak_alias (__cfgetibaud, cfgetibaud)
+
+int
+__cfsetobaud (struct termios *termios_p, baud_t baud)
+{
+  return __cfsetospeed (termios_p, baud);
+}
+libc_hidden_def (__cfsetobaud)
+weak_alias (__cfsetobaud, cfsetobaud)
+
+int
+__cfsetibaud (struct termios *termios_p, baud_t baud)
+{
+  return __cfsetispeed (termios_p, baud);
+}
+libc_hidden_def (__cfsetibaud)
+weak_alias (__cfsetibaud, cfsetibaud)
diff --git a/termios/cfsetbaud.c b/termios/cfsetbaud.c
new file mode 100644
index 000000000000..b76b51e4dd77
--- /dev/null
+++ b/termios/cfsetbaud.c
@@ -0,0 +1,29 @@
+/* Copyright (C) 1992-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/>.  */
+
+#include <termios.h>
+#include <errno.h>
+#include <stddef.h>
+
+/* Set both the input and output baud rates stored in *TERMIOS_P to BAUD.  */
+int
+__cfsetbaud (struct termios *termios_p, baud_t baud)
+{
+  return __cfsetspeed (termios_p, baud);
+}
+libc_hidden_def (__cfsetbaud)
+weak_alias (__cfsetbaud, cfsetbaud)
diff --git a/termios/cfsetspeed.c b/termios/cfsetspeed.c
index 257c6387aaa0..a68e63a9a0c3 100644
--- a/termios/cfsetspeed.c
+++ b/termios/cfsetspeed.c
@@ -21,13 +21,15 @@
 
 /* Set both the input and output baud rates stored in *TERMIOS_P to SPEED.  */
 int
-cfsetspeed (struct termios *termios_p, speed_t speed)
+__cfsetspeed (struct termios *termios_p, speed_t speed)
 {
   int rv;
 
-  rv = cfsetospeed (termios_p, speed);
+  rv = __cfsetospeed (termios_p, speed);
   if (rv)
     return rv;
 
-  return cfsetispeed (termios_p, speed);
+  return __cfsetispeed (termios_p, speed);
 }
+libc_hidden_def (__cfsetspeed)
+weak_alias (__cfsetspeed, cfsetspeed)
diff --git a/termios/speed.c b/termios/speed.c
index d65bf03567f3..5030621518fa 100644
--- a/termios/speed.c
+++ b/termios/speed.c
@@ -22,21 +22,25 @@
 
 /* Return the output baud rate stored in *TERMIOS_P.  */
 speed_t
-cfgetospeed (const struct termios *termios_p)
+__cfgetospeed (const struct termios *termios_p)
 {
   return termios_p->__ospeed;
 }
+libc_hidden_def (__cfgetospeed)
+weak_alias (__cfgetospeed, cfgetospeed)
 
 /* Return the input baud rate stored in *TERMIOS_P.  */
 speed_t
-cfgetispeed (const struct termios *termios_p)
+__cfgetispeed (const struct termios *termios_p)
 {
   return termios_p->__ispeed;
 }
+libc_hidden_def (__cfgetispeed)
+weak_alias (__cfgetispeed, cfgetispeed)
 
 /* Set the output baud rate stored in *TERMIOS_P to SPEED.  */
 int
-cfsetospeed (struct termios *termios_p, speed_t speed)
+__cfsetospeed (struct termios *termios_p, speed_t speed)
 {
   if (termios_p == NULL)
     {
@@ -47,11 +51,12 @@ cfsetospeed (struct termios *termios_p, speed_t speed)
   termios_p->__ospeed = speed;
   return 0;
 }
-libc_hidden_def (cfsetospeed)
+libc_hidden_def (__cfsetospeed)
+weak_alias (__cfsetospeed, cfsetospeed)
 
 /* Set the input baud rate stored in *TERMIOS_P to SPEED.  */
 int
-cfsetispeed (struct termios *termios_p, speed_t speed)
+__cfsetispeed (struct termios *termios_p, speed_t speed)
 {
   if (termios_p == NULL)
     {
@@ -62,4 +67,5 @@ cfsetispeed (struct termios *termios_p, speed_t speed)
   termios_p->__ispeed = speed;
   return 0;
 }
-libc_hidden_def (cfsetispeed)
+libc_hidden_def (__cfsetispeed)
+weak_alias (__cfsetispeed, cfsetispeed)
diff --git a/termios/termios.h b/termios/termios.h
index 1755c505272f..788c98240596 100644
--- a/termios/termios.h
+++ b/termios/termios.h
@@ -59,8 +59,25 @@ extern int cfsetispeed (struct termios *__termios_p, speed_t __speed) __THROW;
 #ifdef	__USE_MISC
 /* Set both the input and output baud rates in *TERMIOS_OP to SPEED.  */
 extern int cfsetspeed (struct termios *__termios_p, speed_t __speed) __THROW;
-#endif
 
+/* Interfaces that are explicitly numeric representations of baud rates */
+typedef speed_t baud_t;
+
+/* Return the output baud rate stored in *TERMIOS_P.  */
+extern baud_t cfgetobaud (const struct termios *__termios_p) __THROW;
+
+/* Return the input baud rate stored in *TERMIOS_P.  */
+extern baud_t cfgetibaud (const struct termios *__termios_p) __THROW;
+
+/* Set the output baud rate stored in *TERMIOS_P to BAUD.  */
+extern int cfsetobaud (struct termios *__termios_p, baud_t __baud) __THROW;
+
+/* Set the input baud rate stored in *TERMIOS_P to BAUD.  */
+extern int cfsetibaud (struct termios *__termios_p, baud_t __baud) __THROW;
+
+/* Set both the input and output baud rates in *TERMIOS_OP to BAUD.  */
+extern int cfsetbaud (struct termios *__termios_p, baud_t __baud) __THROW;
+#endif
 
 /* Put the state of FD into *TERMIOS_P.  */
 extern int tcgetattr (int __fd, struct termios *__termios_p) __THROW;
-- 
2.49.0



More information about the Libc-alpha mailing list