Mirror of the gdb-patches mailing list
 help / color / mirror / Atom feed
From: Sunil Kumar Dora <sunilkumar.dora@windriver.com>
To: Kevin Buettner <kevinb@redhat.com>
Cc: gdb-patches@sourceware.org, macro@orcam.me.uk,
	Randy.MacLeod@windriver.com, Sundeep.Kokkonda@windriver.com,
	schwab@linux-m68k.org, tromey@sourceware.org, simark@simark.ca
Subject: Re: [PATCH V3] PR gdb/33747: gdb/ser-unix: modernize Linux custom baud rate support
Date: Mon, 23 Mar 2026 01:19:54 +0530	[thread overview]
Message-ID: <00005783-e4a7-4521-8d0b-f6d05bd40dac@windriver.com> (raw)
In-Reply-To: <20260319154254.643d8e82@f42-zbm-amd>

Thanks Kevin.

On 3/20/2026 4:14 AM, Kevin Buettner wrote:
> 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 Thu, 12 Mar 2026 14:01:06 -0700
> sunilkumar.dora@windriver.com wrote:
>
>> diff --git a/gdb/ser-unix.c b/gdb/ser-unix.c
>> index c295a9c5ba1..a15f4cc2162 100644
>> --- a/gdb/ser-unix.c
>> +++ b/gdb/ser-unix.c
>> @@ -510,36 +510,59 @@ set_baudcode_baudrate (struct serial *scb, int
>> baud_code)
>>   #if HAVE_CUSTOM_BAUDRATE_SUPPORT && defined(BOTHER)
>>
>> -/* Set a custom baud rate using the termios BOTHER.  */
>> +/* Set a custom baud rate.
>> +
>> +   Prefer the POSIX cfsetispeed/cfsetospeed interface when it accepts
>> +   arbitrary baud rates.  Otherwise fall back to Linux-specific termios2
>> +   (BOTHER) or legacy termios interfaces.  */
>>
>>   static void
>>   set_custom_baudrate_linux (int fd, int rate)
>>   {
>> -#ifdef TCGETS2
>> -  struct termios2 tio;
>> -  const unsigned long req_get = TCGETS2;
>> -  const unsigned long req_set = TCSETS2;
>> -#else
>> +#if defined(HAVE_CFSETSPEED_ARBITRARY)
> Can you add a comment about how this code path is supported by glibc
> 2.42+ ?  You could also mention that this behavior is expected to be
> standardized by a future POSIX revision.
In V4:
   - set_custom_baudrate_posix() has a comment added as suggested,
     including the glibc 2.42+ support and future POSIX direction.
>
>>     struct termios tio;
>> -  const unsigned long req_get = TCGETS;
>> -  const unsigned long req_set = TCSETS;
>> -#endif
>> +  if (tcgetattr (fd, &tio) < 0)
>> +    perror_with_name (_("Cannot get current baud rate"));
>> +
>> +  cfsetispeed (&tio, rate);
>> +  cfsetospeed (&tio, rate);
> Return values for cfsetispeed and cfsetospeed should be checked.  If
> either call fails, it should either error out or try another way of
> setting the speed.
Return values of cfsetispeed() and cfsetospeed() are now checked, with 
perror_with_name()
called on failure in V4.

Thanks,
Sunil Dora
>
> Kevin
>

  reply	other threads:[~2026-03-22 19:51 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-03-12 21:01 sunilkumar.dora
2026-03-19 22:44 ` Kevin Buettner
2026-03-22 19:49   ` Sunil Kumar Dora [this message]
2026-03-20  1:24 ` Maciej W. Rozycki
2026-03-22 19:55   ` Sunil Kumar Dora

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=00005783-e4a7-4521-8d0b-f6d05bd40dac@windriver.com \
    --to=sunilkumar.dora@windriver.com \
    --cc=Randy.MacLeod@windriver.com \
    --cc=Sundeep.Kokkonda@windriver.com \
    --cc=gdb-patches@sourceware.org \
    --cc=kevinb@redhat.com \
    --cc=macro@orcam.me.uk \
    --cc=schwab@linux-m68k.org \
    --cc=simark@simark.ca \
    --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