[PATCH v2 0/5] termios: _SPEED_MAX and _BAUD_MAX, manual improvements

H. Peter Anvin hpa@zytor.com
Thu Jul 10 22:42:39 GMT 2025


On 2025-06-29 09:16, H. Peter Anvin wrote:
> [ v2: remove a stray chunk in patch 3/5 left from editing ]
> 
> I have been working on an infill library for the baud_t interface, for
> non-glibc and retro-glibc platforms.  In the process, I discovered
> that it would be really useful to have defined constants for the range
> of speed_t and baud_t.
> 
> On *some* platforms, including glibc/Linux, the former was defined as
> __MAX_BAUD, which I carried over to other platforms in my termios
> enabling patches.  However, it is rather confusing since it is called
> "baud" while referring to speed_t.
> 
> I propose the two constants _SPEED_MAX and _BAUD_MAX; the naming is
> based on the typical max constants in C and POSIX like INT_MAX and
> SIZE_MAX, with an additional underscore to avoid stomping on the user
> namespace.
> 
> Please check that the locations of these definitions are reasonable.
> 
> The intent is for these constants to be included in the proposal to
> the POSIX committee to standardize the baud_t interface.
> 

Ping on this patchset?

It would really be useful if the baud_t interfaces can be 
conditionalized on #ifdef _BAUD_MAX, as well as, of course, being able 
to rely on the range.  It would make the legacy infill code I am working 
on be far less compiler dependent.

Thanks!

	-hpa



More information about the Libc-alpha mailing list