Hi Kevin, hi Maciej, Thank you both for the feedback. Kevin — I agree that using _HAVE_STRUCT_TERMIOS_* macros is not appropriate, since those are glibc-internal definitions and not part of a public interface. I will drop that approach and replace it with proper configure-time feature detection. Maciej — Thank you for the suggestion regarding detection of arbitrary baud rate support. Checking whether the Bxxx macros expand to their numeric baud rate equivalents is a very clean way to determine whether cfsetospeed/cfsetispeed accept arbitrary speeds. I will try this approach in configure to detect support. I’ll rework the patch accordingly to: - Use autoconf to detect arbitrary-speed support for cfset* - Prefer the POSIX interface when available - Fall back to the termios2 (BOTHER) interface when necessary - Avoid relying on libc-internal definitions I will send a v2 shortly. Thanks again for the review. Best regards, Sunil ________________________________ From: Maciej W. Rozycki Sent: Saturday, February 14, 2026 12:28 AM To: Kevin Buettner Cc: Dora, Sunil Kumar ; gdb-patches@sourceware.org ; simon.marchi@efficios.com ; tromey@sourceware.org ; Kokkonda, Sundeep Subject: Re: [PATCH] gdb/ser-unix: avoid musl build failure when setting custom baud rates CAUTION: This email comes from a non Wind River email account! Do not click links or open attachments unless you recognize the sender and know the content is safe. On Fri, 13 Feb 2026, Kevin Buettner wrote: > 2) I don't think that it's correct to call cfsetospeed and cfsetispeed > with arbitrary baud rates. According to the man page, these > functions expect to be passed one of the "B" constants like B1200, > B9600, etc, not arbitrary speeds. The existing code which uses the > BOTHER extension is the correct way to do this. FYI as from v2.42 glibc finally does support arbitrary baud rates with `cfsetospeed' and `cfsetispeed' with Linux as well, in addition to Hurd, which it has been since forever. This is fully documented in the glibc manual; the man page you refer to is likely outdated. The BOTHER flag is the raw OS kernel interface and its direct use is discouraged. Cf. , , . The position of the POSIX committee WRT the API is quoted there. You can use autoconf to determine whether arbitrary baud rates are supported, by checking if one of the Bxxx macros expands to its numeric baud rate equivalent (you can check a couple if you feel pedantic). With older versions of glibc and possibly other C library implementations Bxxx macros have to be used of course and the choice of baud rates available this way is limited. Resorting to using the BOTHER flag might be the best approach, but the POSIX interface seems like the best first choice. Maciej