Trying again for termios sanity on Linux

H. Peter Anvin hpa@zytor.com
Fri Mar 21 20:57:38 GMT 2025


Some 17 years after Linux acquired the ability to set arbitrary and 
split baud rates for ttys, that support is still not in glibc, with the 
result that just about anything that uses serial ports ends up 
duplicating the entire <termios.h> functionality using the kernel 
termios2 structure, often incorrectly.

The main holdup has been that mips and sparc use a legacy compatibility 
format for struct termios, which doesn't have the speed fields; the 
existing glibc implementations additionally uses them incorrectly.

The consensus at the time seemed to be that this should be fixed by 
symbol-versioning the termios interface, and I have started hacking up 
an implementation thereof against the glibc git tree.

What isn't clear to me is how to handle legacy structures and macros (in 
this case the Bnnn macros) in the header files. Are they supposed to 
contain some kind of #ifdefs, or is the user simply expected to compile 
against an older version of glibc (headers and .so files) if they want 
backwards compatibility?

(The latter is obviously a lot simpler...)

Thanks,

	-hpa



More information about the Libc-alpha mailing list