[PATCH v5 0/2] PR gdb/33747: gdb/ser-unix: fix musl build failure and add POSIX custom baud rate support

sunilkumar.dora
2026-03-24T16:47:31Z

From: Sunil Dora <sunilkumar.dora@windriver.com>

On musl-based systems <asm/termbits.h> exposes BOTHER, so the
Linux-specific custom baud rate path was being compiled. However,
musl's struct termios does not provide the public members c_ispeed
and c_ospeed, causing a build failure.

This series fixes the build issue at the macro level (patch 1).
It then adds the preferred POSIX cfsetispeed/cfsetospeed path as the
first choice on platforms where the host libc supports arbitrary baud
rates, such as glibc 2.42 and later, GNU Hurd, and potentially other
libc implementations (patch 2). The existing Linux (termios2/BOTHER)
and Darwin (IOSSIOSPEED) paths remain as fallbacks.

The two patches are independent:
- Patch 1 is a pure build fix with no functional change.
- Patch 2 adds the new POSIX feature on top of the fixed guard.

set_custom_baudrate_linux is left unchanged.

Changes since V4:
- Split into two patches, with patch 1 as a pure build fix
and patch 2 adding the POSIX interface.
- Fixed #if guard formatting and added full stop to the
AC_DEFINE description.
- Removed parentheses from function name references in
commit messages and comments.
- Updated NEWS entry to describe which configurations are
affected.

v4: https://sourceware.org/pipermail/gdb-patches/2026-March/226133.html
v3: https://sourceware.org/pipermail/gdb-patches/2026-March/225952.html
v2: https://sourceware.org/pipermail/gdb-patches/2026-February/225251.html
v1: https://sourceware.org/pipermail/gdb-patches/2026-February/224968.html

Bug: https://sourceware.org/bugzilla/show_bug.cgi?id=33747

Sunil Dora (2):
gdb/ser-unix: fix musl build failure when setting custom baud rates
gdb/ser-unix: add POSIX cfsetispeed/cfsetospeed support for custom
baud rates

gdb/NEWS | 6 ++++++
gdb/config.in | 6 ++++++
gdb/configure | 52 ++++++++++++++++++++++++++++++++++++++++++++++++
gdb/configure.ac | 22 ++++++++++++++++++++
gdb/ser-unix.c | 47 ++++++++++++++++++++++++++++++++++++-------
5 files changed, 126 insertions(+), 7 deletions(-)

--
2.49.0