Mirror of the gdb-patches mailing list
 help / color / mirror / Atom feed
From: Kevin Buettner <kevinb@redhat.com>
To: Sunil Kumar Dora <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: Tue, 10 Mar 2026 10:39:05 -0700	[thread overview]
Message-ID: <20260310103905.5c9a293e@f42-zbm-amd> (raw)
In-Reply-To: <5eed2d46-87fe-4a75-8246-bcda5438d826@windriver.com>

On Tue, 10 Mar 2026 19:08:15 +0530
Sunil Kumar Dora <sunilkumar.dora@windriver.com> wrote:

> > 3) I'd like to better understand what we might be losing by
> >     eliminating the fallback to TCGETS.  
> While looking into this, I noticed that on some architectures such as 
> PowerPC and Alpha, the normal
> /struct termios/ (not /termios2/) actually has /c_ispeed/ and /c_ospeed/ 
> fields. Because of this,
> those systems *might *still support custom baud rates using the older 
> /TCGETS/ interface.
> 
> The *build failure on musl *happens because musl follows strict POSIX, 
> and its /struct termios/ does not
> include these members (`/c_ispeed`/ and `/c_ospeed`/) on any architecture.
> 
> To handle both cases, would it make sense to keep the /TCGETS/ fallback 
> but guard it with a feature check like
> /AC_CHECK_MEMBERS([struct termios.c_ospeed])/?
> 
> That way we can still support the legacy behavior on glibc systems, 
> while avoiding build issues on musl
> where those fields don't exist.
> 
> This would result in something like the following compile-time paths:
> ----
> /#if defined(HAVE_CFSETSPEED_ARBITRARY)
>    /* Use cfsetispeed()/cfsetospeed() */
> 
> #elif defined(TCGETS2)
>    /* Use Linux termios2 interface with BOTHER */
> 
> #elif defined(HAVE_STRUCT_TERMIOS_C_OSPEED) && defined(BOTHER)
>    /* Legacy fallback using TCGETS/TCSETS */
> 
> #else
>    /* Custom baud rates not supported */
> #endif/
> 
> 
> I’m thinking this might be a reasonable approach, but please let me know 
> if I’m missing something.

That approach looks reasonable to me.

Kevin


      reply	other threads:[~2026-03-10 17:40 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
2026-03-10 13:38   ` Sunil Kumar Dora
2026-03-10 17:39     ` Kevin Buettner [this message]

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=20260310103905.5c9a293e@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