From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from simark.ca by simark.ca with LMTP id ySVjHSg7wWkgqDUAWB0awg (envelope-from ) for ; Mon, 23 Mar 2026 09:07:52 -0400 Authentication-Results: simark.ca; dkim=pass (2048-bit key; unprotected) header.d=gnu.org header.i=@gnu.org header.a=rsa-sha256 header.s=fencepost-gnu-org header.b=B4+tpRhg; dkim-atps=neutral Received: by simark.ca (Postfix, from userid 112) id 732501E0BC; Mon, 23 Mar 2026 09:07:52 -0400 (EDT) X-Spam-Checker-Version: SpamAssassin 4.0.1 (2024-03-25) on simark.ca X-Spam-Level: X-Spam-Status: No, score=-3.4 required=5.0 tests=ARC_SIGNED,ARC_VALID,BAYES_00, DKIMWL_WL_HIGH,DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,MAILING_LIST_MULTI, RCVD_IN_DNSWL_MED,RCVD_IN_VALIDITY_CERTIFIED_BLOCKED, RCVD_IN_VALIDITY_RPBL_BLOCKED,RCVD_IN_VALIDITY_SAFE_BLOCKED autolearn=unavailable autolearn_force=no version=4.0.1 Received: from vm01.sourceware.org (vm01.sourceware.org [38.145.34.32]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange x25519 server-signature ECDSA (prime256v1) server-digest SHA256) (No client certificate requested) by simark.ca (Postfix) with ESMTPS id D6C711E04F for ; Mon, 23 Mar 2026 09:07:51 -0400 (EDT) Received: from vm01.sourceware.org (localhost [127.0.0.1]) by sourceware.org (Postfix) with ESMTP id 9DBBF4B97004 for ; Mon, 23 Mar 2026 13:07:50 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 9DBBF4B97004 Authentication-Results: sourceware.org; dkim=pass (2048-bit key, unprotected) header.d=gnu.org header.i=@gnu.org header.a=rsa-sha256 header.s=fencepost-gnu-org header.b=B4+tpRhg Received: from eggs.gnu.org (eggs.gnu.org [IPv6:2001:470:142:3::10]) by sourceware.org (Postfix) with ESMTPS id 9581D4BA2E0D; Mon, 23 Mar 2026 13:07:25 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org 9581D4BA2E0D Authentication-Results: sourceware.org; dmarc=pass (p=none dis=none) header.from=gnu.org Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=gnu.org ARC-Filter: OpenARC Filter v1.0.0 sourceware.org 9581D4BA2E0D Authentication-Results: server2.sourceware.org; arc=none smtp.remote-ip=2001:470:142:3::10 ARC-Seal: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1774271245; cv=none; b=LSacGklQlgsKSaFok6bnN+a45eN2FLEtjOZcBX27yScv4FXxABwulninl3+ZDq7QjC0RskQ4VKqRo2F69NQ1jaX7U8fveirZgpB3xH0I0rxvaAHY2YKOK5IQhJHkxbjnaUgFKAA3jYVf7AOx34vTU14NjSCme2+6mEemEI5/zZo= ARC-Message-Signature: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1774271245; c=relaxed/simple; bh=fC+iJf4oA7KpZnR6hCw4YezFpyEj/2BVBg2Z2KqYHz0=; h=DKIM-Signature:Date:Message-Id:From:To:Subject; b=qZNfkOqxH/61o9B9Cimx+jZZBF92cmWxD4AZ2JAF4okLnAEPTs/NJkb9NqAMUMqbXpJfr17mAXoYbT4r2WpygLy88sBmAz+BjzN1XWOIdJLq7+1fHlFAVmG3+4pukj+JT0nRoPETD85rtCNROc/jbSt8bl+ANhF9/+sH4PCRlj8= ARC-Authentication-Results: i=1; server2.sourceware.org DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 9581D4BA2E0D Received: from fencepost.gnu.org ([2001:470:142:3::e]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1w4f05-0007Yx-05; Mon, 23 Mar 2026 09:07:22 -0400 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=gnu.org; s=fencepost-gnu-org; h=References:Subject:In-Reply-To:To:From:Date: mime-version; bh=A4NLxW+eV+KpKj4oRvGxP5Ww7yGPFb0WOGIB55VGoIg=; b=B4+tpRhgzYjt dSYMBnXPyVogibfMfmSUONn3wMbgqeGFSv8sdnDTWQ3CedPGxayppRFutIgFHUtvF6Tr75d7K9KJn +QMKh8sX4CaWy66Tivhz2jABbRXjaYvXVeOV5+FjHp9opeAv2ANUE4MhyBihpzQZ79BHfdQ2Nansf sEqFdrBENuWzcIajj6vgLlXmQdCYoLCBGk56CvLewhwLbKU/A3CetRKLUgyzi7rMhdFUazu8dBwDh vwIr5cm58uS3cLDtHZ2GfmILq5H6KyKPOIWK5ccyEOrA5mrYXW16NIWhol1OFKrLhzyD4RV5XUxPn sQp+RWvcwKHdU1kA4TOqig==; Date: Mon, 23 Mar 2026 15:06:27 +0200 Message-Id: <86qzpazodo.fsf@gnu.org> From: Eli Zaretskii To: sunilkumar.dora@windriver.com Cc: gdb-patches@sourceware.org, kevinb@redhat.com, macro@orcam.me.uk, Randy.MacLeod@windriver.com, Sundeep.Kokkonda@windriver.com, schwab@linux-m68k.org, tromey@sourceware.org, simark@simark.ca In-Reply-To: <20260323112746.2332070-1-sunilkumar.dora@windriver.com> Subject: Re: [PATCH V4] PR gdb/33747: gdb/ser-unix: modernize and fix custom baud rate support on musl References: <20260323112746.2332070-1-sunilkumar.dora@windriver.com> X-BeenThere: gdb-patches@sourceware.org X-Mailman-Version: 2.1.30 Precedence: list List-Id: Gdb-patches mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: gdb-patches-bounces~public-inbox=simark.ca@sourceware.org > From: sunilkumar.dora@windriver.com > Cc: kevinb@redhat.com, macro@orcam.me.uk, Randy.MacLeod@windriver.com, > Sundeep.Kokkonda@windriver.com, schwab@linux-m68k.org, > tromey@sourceware.org, simark@simark.ca, SunilKumar.Dora@windriver.com > Date: Mon, 23 Mar 2026 04:27:46 -0700 > > From: Sunil Dora > > On musl-based systems, may expose BOTHER even though > struct termios does not define c_ispeed/c_ospeed. This causes the > Linux-specific custom baud rate path to be compiled and fail to build. > > Fix this at the macro level by requiring HAVE_STRUCT_TERMIOS_C_OSPEED > alongside BOTHER in the HAVE_CUSTOM_BAUDRATE_SUPPORT guard. This > prevents the Linux-specific path from being compiled on systems where > the required fields are unavailable, leaving set_custom_baudrate_linux() > unchanged. > > Introduce a platform-agnostic implementation using the POSIX > cfsetispeed/cfsetospeed interface, guarded by HAVE_CFSETSPEED_ARBITRARY. > This interface is supported by glibc 2.42 and later and is expected to > be standardized by a future POSIX revision. It also covers systems > such as GNU Hurd that do not provide BOTHER. Return values from > cfsetispeed() and cfsetospeed() are checked, and errors are reported > via perror_with_name(). > > Update the dispatcher to prefer the POSIX implementation when available, > falling back to Linux-specific (BOTHER) or Darwin-specific (IOSSIOSPEED) > mechanisms otherwise. > > Suggested-by: Kevin Buettner > Suggested-by: Maciej W. Rozycki > Signed-off-by: Sunil Dora > --- > Changes since V3: > > - Moved the fix to the macro level, requiring > HAVE_STRUCT_TERMIOS_C_OSPEED alongside BOTHER. > - Left set_custom_baudrate_linux() completely unchanged. > - Introduced set_custom_baudrate_posix(), guarded by > HAVE_CFSETSPEED_ARBITRARY. > - Added return value checks for cfsetispeed() and cfsetospeed(). > - Extended HAVE_CUSTOM_BAUDRATE_SUPPORT for systems with > HAVE_CFSETSPEED_ARBITRARY. > - Removed the #else error() fallback. > - Updated comments to reflect the new behaviour. > > gdb/NEWS | 7 +++++++ > gdb/config.in | 6 ++++++ > gdb/configure | 52 ++++++++++++++++++++++++++++++++++++++++++++++++ > gdb/configure.ac | 22 ++++++++++++++++++++ > gdb/ser-unix.c | 43 ++++++++++++++++++++++++++++++++++----- > 5 files changed, 125 insertions(+), 5 deletions(-) Thanks. > diff --git a/gdb/NEWS b/gdb/NEWS > index e46a5108272..967787783e2 100644 > --- a/gdb/NEWS > +++ b/gdb/NEWS > @@ -36,6 +36,13 @@ > subsequent runs of the inferior will use the same arguments as the > first run. > > +* GDB now supports arbitrary baud rates on systems where the host libc > + accepts them via cfsetispeed/cfsetospeed (such as glibc 2.42+). > + On Linux systems where this is not available, GDB falls back to the > + termios2 (BOTHER) interface. The legacy termios fallback is now > + only compiled on systems where struct termios exposes c_ispeed > + and c_ospeed. > + > * Support for stabs debug information has been removed. This entry could be more useful if it explained which GDB functionalities are affected by these changes. Otherwise, I'm not sure it will be clear to the reader whether and when should he/she be bothered or excited by these changes. Reviewed-By: Eli Zaretskii