From: "Maciej W. Rozycki" <macro@orcam.me.uk>
To: Kevin Buettner <kevinb@redhat.com>
Cc: sunilkumar.dora@windriver.com, gdb-patches@sourceware.org,
simon.marchi@efficios.com, tromey@sourceware.org,
Sundeep.Kokkonda@windriver.com
Subject: Re: [PATCH] gdb/ser-unix: avoid musl build failure when setting custom baud rates
Date: Fri, 13 Feb 2026 18:58:46 +0000 (GMT) [thread overview]
Message-ID: <alpine.DEB.2.21.2602131814260.2574@angie.orcam.me.uk> (raw)
In-Reply-To: <20260213110817.10346c83@f42-zbm-amd>
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.
<https://inbox.sourceware.org/libc-alpha/20250612013546.1524096-1-hpa@zytor.com/>,
<https://sourceware.org/bugzilla/show_bug.cgi?id=10339>,
<https://sourceware.org/git/gitweb.cgi?p=glibc.git;h=5f138519ebdf88e1fc5395d65df0b780dd07829a>.
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
next prev parent reply other threads:[~2026-02-13 18:59 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-02-13 15:21 sunilkumar.dora
2026-02-13 18:08 ` Kevin Buettner
2026-02-13 18:58 ` Maciej W. Rozycki [this message]
2026-02-13 21:21 ` Dora, Sunil Kumar
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=alpine.DEB.2.21.2602131814260.2574@angie.orcam.me.uk \
--to=macro@orcam.me.uk \
--cc=Sundeep.Kokkonda@windriver.com \
--cc=gdb-patches@sourceware.org \
--cc=kevinb@redhat.com \
--cc=simon.marchi@efficios.com \
--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