Go to file
H. Peter Anvin (Intel) 5cf101a85a linux: implement arbitrary and split speeds in termios
Linux has supported arbitrary speeds and split speeds in the kernel
since 2008 on all platforms except Alpha (fixed in 2020), but glibc
was never updated to match. This is further complicated by POSIX uses
of macros for the cf[gs]et[io]speed interfaces, rather than plain
numbers, as it really ought to have.

On most platforms, the glibc ABI includes the c_[io]speed fields in
struct termios, but they are incorrectly used. On MIPS and SPARC, they
are entirely missing.

For backwards compatibility, the kernel will still use the legacy
speed fields unless they are set to BOTHER, and will use the legacy
output speed as the input speed if the latter is 0 (== B0). However,
the specific encoding used is visible to user space applications,
including ones other than the one running.

- SPARC and MIPS get a new struct termios, and tc[gs]etattr() is
  versioned accordingly. However, the new struct termios is set to be
  a strict extension of the old one, which means that cf* interfaces
  other than the speed-related ones do not need versioning.
- The Bxxx constants are redefined as equivalent to their integer
  values and the legacy Bxxx constants are renamed __Bxxx.
- cf[gs]et[io]speed() and cfsetspeed() are versioned accordingly.
- tcgetattr() and cfset[io]speed() are adjusted to always keep the
  c_[io]speed fields correct (unlike earlier versions), but to
  canonicalize the representation to ALSO configure the legacy fields
  if a valid legacy representation exists.
- tcsetattr(), too, canonicalizes the representation in this way
  before passing it to the kernel, to maximize compatibility with
  older applications/tools.
- The old IBAUD0 hack is removed; it is no longer necessary since
  even the legacy c_cflag baud rate fields have had separate input
  values for a long time.

Signed-off-by: H. Peter Anvin (Intel) <hpa@zytor.com>
Reviewed-by: Adhemerval Zanella  <adhemerval.zanella@linaro.org>
2025-06-17 09:11:38 -03:00
ChangeLog.old Create ChangeLog.old/ChangeLog.30 2025-01-28 18:31:33 +01:00
advisories Update advisory GLIBC-SA-2025-0003 and GLIBC-SA-2025-0004 2025-06-17 08:05:26 -04:00
argp argp: Fix shift bug 2025-06-02 13:32:19 -03:00
assert assert: Add test for CVE-2025-0395 2025-02-13 12:33:27 -05:00
benchtests benchtests: Improve modf benchtest 2025-06-13 11:30:12 -03:00
bits AArch64: Implement AdvSIMD and SVE atan2pi/f 2025-05-19 15:35:25 +00:00
catgets
conform linknamespace: Use 'ALLOWLIST' instead of 'WHITELIST' in code. 2025-05-21 12:47:49 -04:00
csu elf: Build dl-tls.o with early startup symbol redirections 2025-02-05 09:52:16 +01:00
ctype ctype: Fallback initialization of TLS using relocations (bug 19341, bug 32483) 2025-05-16 19:53:09 +02:00
debug Add _FORTIFY_SOURCE support for inet_pton 2025-03-24 14:43:03 -04:00
dirent
dlfcn
elf elf: Add optimization barrier for __ehdr_start and _end 2025-06-16 08:43:40 +08:00
gmon
gnulib
hesiod
htl htl: move pthread_key_*, pthread_get/setspecific 2025-06-15 21:21:12 +02:00
hurd hurd: Avoid -Wfree-labels warning in _hurd_intr_rpc_mach_msg 2025-05-28 09:59:24 +02:00
iconv
iconvdata
include io: replace local_isatty() with a proper function __isatty_nostatus() 2025-06-17 09:11:38 -03:00
inet Add _FORTIFY_SOURCE support for inet_pton 2025-03-24 14:43:03 -04:00
intl
io io: replace local_isatty() with a proper function __isatty_nostatus() 2025-06-17 09:11:38 -03:00
libio io: replace local_isatty() with a proper function __isatty_nostatus() 2025-06-17 09:11:38 -03:00
locale Always check lockf64 return value 2025-06-16 14:48:45 +08:00
localedata localedata: Correct Persian collation rules description 2025-05-30 15:01:48 +01:00
login termios: make __tcsetattr() the internal interface 2025-06-17 09:11:38 -03:00
mach hurd: Make __getrandom_early_init call __mach_init 2025-06-09 08:34:06 +00:00
malloc malloc: Sort tests-exclude-largetcache in Makefile 2025-06-17 06:06:06 +08:00
manual manual: Add a comparative example of 'clock_nanosleep' use 2025-06-06 18:14:34 +01:00
math gen-libm-test: Use 'original source' instead of 'master' in code. 2025-05-21 12:48:00 -04:00
mathvec
misc termios: make __tcsetattr() the internal interface 2025-06-17 09:11:38 -03:00
nis
nptl nptl: Check if thread is already terminated in sigcancel_handler (BZ 32782) 2025-03-13 09:11:13 -03:00
nptl_db
nscd
nss Makefile: Avoid $(objpfx)/ in makefiles 2025-06-04 17:44:19 +02:00
po po: update translations (final, only timestamp and line number changes) 2025-01-28 13:47:28 +01:00
posix posix: fix building regex when _LIBC isn't defined 2025-06-04 13:55:23 +02:00
resolv resolv: Add test for getaddrinfo returning FQDN in ai_canonname 2025-06-10 15:10:31 +02:00
resource
rt aio_suspend64: Fix clock discrepancy [BZ #32795] 2025-03-25 01:05:11 +01:00
scripts Use Linux 6.15 in build-many-glibcs.py 2025-05-28 14:15:51 +00:00
setjmp
signal
socket
soft-fp
stdio-common stdio-common: Add nonnull attribute to stdio_ext.h functions. 2025-06-02 13:32:19 -03:00
stdlib Fix error reporting (false negatives) in SGID tests 2025-05-22 14:36:37 +02:00
string Remove <libc-tsd.h> 2025-05-16 19:53:09 +02:00
sunrpc Remove <libc-tsd.h> 2025-05-16 19:53:09 +02:00
support Fix error reporting (false negatives) in SGID tests 2025-05-22 14:36:37 +02:00
sysdeps linux: implement arbitrary and split speeds in termios 2025-06-17 09:11:38 -03:00
sysvipc
termios termios: make __tcsetattr() the internal interface 2025-06-17 09:11:38 -03:00
time Remove <libc-tsd.h> 2025-05-16 19:53:09 +02:00
timezone timezone: Enhance tst-bz28707 diagnostics 2025-04-10 10:08:30 +02:00
wcsmbs
wctype
.b4-config
.clang-format
.gitattributes
.gitignore
CONTRIBUTED-BY
COPYING
COPYING.LIB
INSTALL INSTALL: Regenerate with texinfo 7.2 2025-05-22 17:08:59 +02:00
LICENSES LICENSES: update CORE-MATH copyright 2025-01-24 23:21:49 +01:00
MAINTAINERS
Makeconfig Move C warning flags from +gccwarn to +gccwarn-c 2025-05-27 16:09:39 +02:00
Makefile
Makefile.help
Makefile.in math: Refactor how to use libm-test-ulps 2025-03-12 13:40:07 -03:00
Makerules Makerules: Use 'original' instead of 'master' in source. 2025-05-21 12:48:04 -04:00
NEWS linux: implement arbitrary and split speeds in termios 2025-06-17 09:11:38 -03:00
README
Rules malloc: add testing for large tcache support 2025-06-16 12:54:32 +00:00
SECURITY.md
SHARED-FILES math: Use tanpif from CORE-MATH 2025-02-12 16:31:57 -03:00
abi-tags
aclocal.m4
config.h.in AArch64: Cleanup SVE config and defines 2025-05-20 10:33:55 +00:00
config.make.in Pass -Wl,--no-error-execstack for tests where -Wl,-z,execstack is used [PR32717] 2025-03-04 20:08:50 +00:00
configure Turn on -Wmissing-parameter-name by default if available 2025-05-27 07:15:06 +02:00
configure.ac Turn on -Wmissing-parameter-name by default if available 2025-05-27 07:15:06 +02:00
extra-lib.mk
gen-locales.mk
libc-abis
libof-iterator.mk
o-iterator.mk
shlib-versions
test-skeleton.c
version.h Increase version to 2.41.9000, add new section to NEWS 2025-01-28 18:42:35 +01:00

README

This directory contains the sources of the GNU C Library.
See the file "version.h" for what release version you have.

The GNU C Library is the standard system C library for all GNU systems,
and is an important part of what makes up a GNU system.  It provides the
system API for all programs written in C and C-compatible languages such
as C++ and Objective C; the runtime facilities of other programming
languages use the C library to access the underlying operating system.

In GNU/Linux systems, the C library works with the Linux kernel to
implement the operating system behavior seen by user applications.
In GNU/Hurd systems, it works with a microkernel and Hurd servers.

The GNU C Library implements much of the POSIX.1 functionality in the
GNU/Hurd system, using configurations i[4567]86-*-gnu and x86_64-gnu.

When working with Linux kernels, this version of the GNU C Library
requires Linux kernel version 3.2 or later.

Also note that the shared version of the libgcc_s library must be
installed for the pthread library to work correctly.

The GNU C Library supports these configurations for using Linux kernels:

	aarch64*-*-linux-gnu
	alpha*-*-linux-gnu
	arc*-*-linux-gnu
	arm-*-linux-gnueabi
	csky-*-linux-gnuabiv2
	hppa-*-linux-gnu
	i[4567]86-*-linux-gnu
	x86_64-*-linux-gnu	Can build either x86_64 or x32
	loongarch64-*-linux-gnu Hardware floating point, LE only.
	m68k-*-linux-gnu
	microblaze*-*-linux-gnu
	mips-*-linux-gnu
	mips64-*-linux-gnu
	or1k-*-linux-gnu
	powerpc-*-linux-gnu	Hardware or software floating point, BE only.
	powerpc64*-*-linux-gnu	Big-endian and little-endian.
	s390-*-linux-gnu
	s390x-*-linux-gnu
	riscv32-*-linux-gnu
	riscv64-*-linux-gnu
	sh[34]-*-linux-gnu
	sparc*-*-linux-gnu
	sparc64*-*-linux-gnu

If you are interested in doing a port, please contact the glibc
maintainers; see https://www.gnu.org/software/libc/ for more
information.

See the file INSTALL to find out how to configure, build, and install
the GNU C Library.  You might also consider reading the WWW pages for
the C library at https://www.gnu.org/software/libc/.

The GNU C Library is (almost) completely documented by the Texinfo manual
found in the `manual/' subdirectory.  The manual is still being updated
and contains some known errors and omissions; we regret that we do not
have the resources to work on the manual as much as we would like.  For
corrections to the manual, please file a bug in the `manual' component,
following the bug-reporting instructions below.  Please be sure to check
the manual in the current development sources to see if your problem has
already been corrected.

Please see https://www.gnu.org/software/libc/bugs.html for bug reporting
information.  We are now using the Bugzilla system to track all bug reports.
This web page gives detailed information on how to report bugs properly.

The GNU C Library is free software.  See the file COPYING.LIB for copying
conditions, and LICENSES for notices about a few contributions that require
these additional notices to be distributed.  License copyright years may be
listed using range notation, e.g., 1996-2015, indicating that every year in
the range, inclusive, is a copyrightable year that would otherwise be listed
individually.