Mirror of the gdb-patches mailing list
 help / color / mirror / Atom feed
From: Kevin Buettner <kevinb@redhat.com>
To: sunilkumar.dora@windriver.com
Cc: gdb-patches@sourceware.org, Randy.MacLeod@windriver.com,
	Sundeep.Kokkonda@windriver.com, macro@orcam.me.uk,
	schwab@linux-m68k.org, tromey@sourceware.org, simark@simark.ca
Subject: Re: [PATCH v2] PR gdb/33747: gdb/ser-unix: Avoid musl build failure when setting custom baud rates
Date: Sun, 8 Mar 2026 18:25:09 -0700	[thread overview]
Message-ID: <20260308182509.18b4fe0d@f42-zbm-amd> (raw)
In-Reply-To: <20260222200648.2648865-1-sunilkumar.dora@windriver.com>

Hi Sunil,

On Sun, 22 Feb 2026 12:06:48 -0800
sunilkumar.dora@windriver.com wrote:

> From: Sunil Dora <sunilkumar.dora@windriver.com>
> 
> The Linux custom baud rate implementation accessed the struct termios 
> members c_ispeed and c_ospeed directly. These fields are provided by 
> glibc but are not exposed by musl, which causes the build to fail on 
> musl-based systems.
> 
> Adjust set_custom_baudrate_linux to use a capability-based approach.
> The Autoconf check HAVE_NUMERIC_BAUD_RATES determines whether
> B-constants match numeric baud rates. If they do, use the standard
> POSIX cfsetispeed and cfsetospeed interfaces. Otherwise, fall back
> to the Linux-specific termios2 interface (TCGETS2) to support
> arbitrary baud rates.
> 
> This preserves existing behavior on glibc systems while restoring
> build compatibility with musl.

Here are my concerns:

1) The name HAVE_NUMERIC_BAUD_RATES doesn't really describe the
   feature that we wish to test for.  I think it should convey
   the fact that the implementations of cfsetospeed/cfsetispeed
   available on the platform are capable of accepting (and correctly
   using) arbitrary baud rate values.  Potential names include
   HAVE_CFSETSPEED_ARBITRARY and HAVE_ARBITRARY_BAUD_CFSETSPEED.
   (But if you have some other sensible preference, that's fine
   too.)

2) I don't think that the final perror_with_name() call is correct. 
   (I.e.  the one after the #else.) perror_with_name() should be used
   to print out an error message after calling a function associated
   with some underlying syscall.  But in this instance, there is no
   call - I think you ought to just be using a call to error().

3) I'd like to better understand what we might be losing by
   eliminating the fallback to TCGETS.

4) You might change the commit title to something along the lines
   of "Modernize custom baudrate handling" or some such. This patch
   does much more than narrowly fixing the MUSL build failure.

Kevin


  parent reply	other threads:[~2026-03-09  1:25 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-02-22 20:06 sunilkumar.dora
2026-02-23  3:24 ` Eli Zaretskii
2026-03-09  1:25 ` Kevin Buettner [this message]
2026-03-10 13:38   ` Sunil Kumar Dora
2026-03-10 17:39     ` Kevin Buettner

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20260308182509.18b4fe0d@f42-zbm-amd \
    --to=kevinb@redhat.com \
    --cc=Randy.MacLeod@windriver.com \
    --cc=Sundeep.Kokkonda@windriver.com \
    --cc=gdb-patches@sourceware.org \
    --cc=macro@orcam.me.uk \
    --cc=schwab@linux-m68k.org \
    --cc=simark@simark.ca \
    --cc=sunilkumar.dora@windriver.com \
    --cc=tromey@sourceware.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox