From patchwork Sun Jul 13 05:19:42 2025 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "H. Peter Anvin" X-Patchwork-Id: 116201 Return-Path: X-Original-To: patchwork@sourceware.org Delivered-To: patchwork@sourceware.org Received: from server2.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id B30D8385841F for ; Sun, 13 Jul 2025 05:23:16 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org B30D8385841F Authentication-Results: sourceware.org; dkim=pass (2048-bit key, unprotected) header.d=zytor.com header.i=@zytor.com header.a=rsa-sha256 header.s=2025062101 header.b=fLDRBEzC X-Original-To: libc-alpha@sourceware.org Delivered-To: libc-alpha@sourceware.org Received: from mail.zytor.com (terminus.zytor.com [IPv6:2607:7c80:54:3::136]) by sourceware.org (Postfix) with ESMTPS id 6B6B63858C51 for ; Sun, 13 Jul 2025 05:19:54 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org 6B6B63858C51 Authentication-Results: sourceware.org; dmarc=pass (p=none dis=none) header.from=zytor.com Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=zytor.com ARC-Filter: OpenARC Filter v1.0.0 sourceware.org 6B6B63858C51 Authentication-Results: server2.sourceware.org; arc=none smtp.remote-ip=2607:7c80:54:3::136 ARC-Seal: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1752383994; cv=none; b=JUmBubSSfUR4i6EmFTVPGJP8EDe9459Mbeww75G3npjS3E9dx2siFefSXjrs43Bv/6RlR/b7ov1S3g3UGJ4dZ8t38hft99Ssp5EsTkHA7mujnBIB1Ch3BBk3f8u7dStHsrZHSlzTZnGCGlcYKI82Ol7lDldPke/I7GhUCmAJyJQ= ARC-Message-Signature: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1752383994; c=relaxed/simple; bh=n29onWHdvI5JobDoR31j613aXDP/MZBnN+WUAIgeI4g=; h=DKIM-Signature:From:To:Subject:Date:Message-ID:MIME-Version; b=OUmk9Y1B7EkSBMB3WLAMgcVISNbPe+PF8aDm3dHJ8xohPISv/eNMSfxfdWzJh+OfETj1+LrNAM1aBuJgxRWXCOZgzsePaGSzRhzmlUW98gICmi6BqoE7ECFRrvTuhnuHHyRdtS6DgGgZH7FlyHjvoR9yNzdmYvJ/+rHPBzB137A= ARC-Authentication-Results: i=1; server2.sourceware.org DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 6B6B63858C51 Received: from mail.zytor.com ([IPv6:2601:646:8081:9482:5253:b53:6783:9834]) (authenticated bits=0) by mail.zytor.com (8.18.1/8.17.1) with ESMTPSA id 56D5Jokn2268726 (version=TLSv1.3 cipher=TLS_AES_256_GCM_SHA384 bits=256 verify=NO); Sat, 12 Jul 2025 22:19:52 -0700 DKIM-Filter: OpenDKIM Filter v2.11.0 mail.zytor.com 56D5Jokn2268726 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=zytor.com; s=2025062101; t=1752383992; bh=i+DO/U4x+4+R4nWWXoaWT/lAdieMfpSOQ9fXHzrnC2A=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=fLDRBEzC7PaYzBizOxKJcQnjUYK+F2HuP/LZvHSTWl2LzVJS7MDMLYTKlldJP5QDy e8BelwSkg2vUi5MBmA1Ts4Myx8tUKK2a5rlob8PFl2pkmeK6tcyhKcoFB06IwzZG5c FvZiBTzfARBtsL6USUgwUhlMuRCyfBBIrn4+RRT02KSO5BXiDtRyRhNCNA+OIKcsMt 0px+Or/D1kxHftJTB8w6g8NAvZFf1+/3vtA3BAHHXvjQP95ix6n5sUtoGlCroKxVic 7fbJdOZmAgcXiS70LIZLsOpWARmvTv6dmzuz8ppn2ISRNy594JJwaA0kNxWtJHY+PR 6Yt57JV1YOWHg== From: "H. Peter Anvin" To: GNU C Library Cc: Adhemerval Zanella Netto , Collin Funk , "H. Peter Anvin" Subject: [PATCH v4 1/3] termios: move the baud_t interface from __USE_MISC to __USE_GNU Date: Sat, 12 Jul 2025 22:19:42 -0700 Message-ID: <20250713051944.782970-2-hpa@zytor.com> X-Mailer: git-send-email 2.50.1 In-Reply-To: <20250713051944.782970-1-hpa@zytor.com> References: <20250713051944.782970-1-hpa@zytor.com> MIME-Version: 1.0 X-Spam-Status: No, score=-12.0 required=5.0 tests=BAYES_00, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, DKIM_VALID_EF, GIT_PATCH_0, SPF_HELO_PASS, SPF_PASS, TXREP autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on server2.sourceware.org X-BeenThere: libc-alpha@sourceware.org X-Mailman-Version: 2.1.30 Precedence: list List-Id: Libc-alpha mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: libc-alpha-bounces~patchwork=sourceware.org@sourceware.org __USE_MISC refers to interfaces imported from BSD or System V, but the baud_t interface is (at least for now) a GNU extension, so move it from __USE_MISC to __USE_GNU. Suggested-by: Collin Funk Signed-off-by: H. Peter Anvin (Intel) Reviewed-by: Collin Funk --- termios/termios.h | 2 ++ 1 file changed, 2 insertions(+) diff --git a/termios/termios.h b/termios/termios.h index 788c98240596..3347c880a57f 100644 --- a/termios/termios.h +++ b/termios/termios.h @@ -59,7 +59,9 @@ extern int cfsetispeed (struct termios *__termios_p, speed_t __speed) __THROW; #ifdef __USE_MISC /* Set both the input and output baud rates in *TERMIOS_OP to SPEED. */ extern int cfsetspeed (struct termios *__termios_p, speed_t __speed) __THROW; +#endif +#ifdef __USE_GNU /* Interfaces that are explicitly numeric representations of baud rates */ typedef speed_t baud_t; From patchwork Sun Jul 13 05:19:43 2025 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "H. Peter Anvin" X-Patchwork-Id: 116202 Return-Path: X-Original-To: patchwork@sourceware.org Delivered-To: patchwork@sourceware.org Received: from server2.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id 846843858C2A for ; Sun, 13 Jul 2025 05:23:54 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 846843858C2A Authentication-Results: sourceware.org; dkim=pass (2048-bit key, unprotected) header.d=zytor.com header.i=@zytor.com header.a=rsa-sha256 header.s=2025062101 header.b=YYbYH67x X-Original-To: libc-alpha@sourceware.org Delivered-To: libc-alpha@sourceware.org Received: from mail.zytor.com (terminus.zytor.com [IPv6:2607:7c80:54:3::136]) by sourceware.org (Postfix) with ESMTPS id 16C623858C54 for ; Sun, 13 Jul 2025 05:19:55 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org 16C623858C54 Authentication-Results: sourceware.org; dmarc=pass (p=none dis=none) header.from=zytor.com Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=zytor.com ARC-Filter: OpenARC Filter v1.0.0 sourceware.org 16C623858C54 Authentication-Results: server2.sourceware.org; arc=none smtp.remote-ip=2607:7c80:54:3::136 ARC-Seal: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1752383995; cv=none; b=hd9TlV+S7MBxFoMzKaDIT42AP8hbZ7NUcWphTECG+0MbB7u7wESEUDDOUbwkgZbqCojDnckZUiDyQz6DeEp70m8zstggZK+xgQY49HfhuaUdlumDVQF5xMu6AyHERAWoZcw7urOJMXnEiPjAF8dotGWYU02BXbBvfFn7ZcJ881E= ARC-Message-Signature: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1752383995; c=relaxed/simple; bh=41YycKc9FRwkxkqKU9DroYTAjj+70YFmw6uQCWzDCtM=; h=DKIM-Signature:From:To:Subject:Date:Message-ID:MIME-Version; b=xKhMsoGrdmCQv3pZJ7kMwS7pCQ0ptcE7V/ra0Uq0/2jDc7xKJxX5Mlq2ixDZcCiKoQlJRrrlnFB369NIcnglbcZn0LSY9Ae/rr2owl+NEYIsF8/ASLjZwdl0L4OUJRG00KWwhPbWUevV8zqhJIe1Dvn1KX5y3cQOB/1mxsdEXbU= ARC-Authentication-Results: i=1; server2.sourceware.org DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 16C623858C54 Received: from mail.zytor.com ([IPv6:2601:646:8081:9482:5253:b53:6783:9834]) (authenticated bits=0) by mail.zytor.com (8.18.1/8.17.1) with ESMTPSA id 56D5Joko2268726 (version=TLSv1.3 cipher=TLS_AES_256_GCM_SHA384 bits=256 verify=NO); Sat, 12 Jul 2025 22:19:52 -0700 DKIM-Filter: OpenDKIM Filter v2.11.0 mail.zytor.com 56D5Joko2268726 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=zytor.com; s=2025062101; t=1752383992; bh=jEefIcV7evZILL6IHMFUjSxxIqOONjkLmS8yAsuRiNo=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=YYbYH67xlB+cOcokkS9OulvoKaXlJnco2m0R78myA/yxu0v7NTcUWFO7HFKfGlVy5 ByOtyLBq0Xc6kiou0BqoqeAt319y8pZsNQ05KoM0GEMWQC1Z9uiO/MexDgAzhj/7Qw VZv84ZOnxgxYvJoF4rbFtqcn+vEFy6Qu8cfwqmiZHMdzl/7oRHi8F8iiDrAX1WlKKt w5bGdAFLB/Zujokmcq2M0r9gLNHCTtG6H0and+3n9ldPOaus6817msLBEBfJ0yjKTP X1Deqc9GsXa1nEOZs8TZrkFq4A50vjKLJsUuMLPPheAsJjC+DEryiqGIifKBbhHy5F 1IVMl1xNgDY0w== From: "H. Peter Anvin" To: GNU C Library Cc: Adhemerval Zanella Netto , Collin Funk , "H. Peter Anvin" Subject: [PATCH v4 2/3] termios: SPEED_MAX and BAUD_MAX constants Date: Sat, 12 Jul 2025 22:19:43 -0700 Message-ID: <20250713051944.782970-3-hpa@zytor.com> X-Mailer: git-send-email 2.50.1 In-Reply-To: <20250713051944.782970-1-hpa@zytor.com> References: <20250713051944.782970-1-hpa@zytor.com> MIME-Version: 1.0 X-Spam-Status: No, score=-11.9 required=5.0 tests=BAYES_00, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, DKIM_VALID_EF, GIT_PATCH_0, SPF_HELO_PASS, SPF_PASS, TXREP autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on server2.sourceware.org X-BeenThere: libc-alpha@sourceware.org X-Mailman-Version: 2.1.30 Precedence: list List-Id: Libc-alpha mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: libc-alpha-bounces~patchwork=sourceware.org@sourceware.org Add constants indicating the maximum values of speed_t and baud_t. Hopefully if and when the baud_t interface is standardized then BAUD_MAX will be included in the standardization from the start. Historically, the __MAX_BAUD symbol has indicated the maximum speed_t value on at least some platforms (including glibc). However, this name would be problematic for future standardization, because it confusingly implies a reference to baud_t, not speed_t, and it is inconsistent with other limit symbols, which are all of the form *_MAX (e.g. SIZE_MAX for size_t.) [ v3: dropped leading underscores, leave __MAX_BAUD outside #ifdef __USE_MISC since it is a legacy symbol, and namespace-protected with a double underscore. (Collin Funk, Adhermerval Zanella Netto) ] [ v4: moved from __USE_MISC to __USE_GNU (Collin Funk) ] Signed-off-by: "H. Peter Anvin" (Intel) Reviewed-by: Collin Funk --- bits/termios-baud.h | 5 ++++- termios/termios.h | 1 + 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/bits/termios-baud.h b/bits/termios-baud.h index bafde1a6505c..697ad8075898 100644 --- a/bits/termios-baud.h +++ b/bits/termios-baud.h @@ -69,4 +69,7 @@ #define B5000000 5000000U #define B10000000 10000000U -#define __MAX_BAUD 4294967295U +#ifdef __USE_GNU +#define SPEED_MAX 4294967295U /* maximum valid speed_t value */ +#endif +#define __MAX_BAUD 4294967295U /* legacy alias for SPEED_MAX */ diff --git a/termios/termios.h b/termios/termios.h index 3347c880a57f..91cbe875e485 100644 --- a/termios/termios.h +++ b/termios/termios.h @@ -64,6 +64,7 @@ extern int cfsetspeed (struct termios *__termios_p, speed_t __speed) __THROW; #ifdef __USE_GNU /* Interfaces that are explicitly numeric representations of baud rates */ typedef speed_t baud_t; +#define BAUD_MAX SPEED_MAX /* Return the output baud rate stored in *TERMIOS_P. */ extern baud_t cfgetobaud (const struct termios *__termios_p) __THROW; From patchwork Sun Jul 13 05:19:44 2025 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "H. Peter Anvin" X-Patchwork-Id: 116200 Return-Path: X-Original-To: patchwork@sourceware.org Delivered-To: patchwork@sourceware.org Received: from server2.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id 8DED73858433 for ; Sun, 13 Jul 2025 05:22:35 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 8DED73858433 Authentication-Results: sourceware.org; dkim=pass (2048-bit key, unprotected) header.d=zytor.com header.i=@zytor.com header.a=rsa-sha256 header.s=2025062101 header.b=B5tWvZiw X-Original-To: libc-alpha@sourceware.org Delivered-To: libc-alpha@sourceware.org Received: from mail.zytor.com (terminus.zytor.com [IPv6:2607:7c80:54:3::136]) by sourceware.org (Postfix) with ESMTPS id 914FA3858C66 for ; Sun, 13 Jul 2025 05:19:55 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org 914FA3858C66 Authentication-Results: sourceware.org; dmarc=pass (p=none dis=none) header.from=zytor.com Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=zytor.com ARC-Filter: OpenARC Filter v1.0.0 sourceware.org 914FA3858C66 Authentication-Results: server2.sourceware.org; arc=none smtp.remote-ip=2607:7c80:54:3::136 ARC-Seal: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1752383995; cv=none; b=XiCLXDOzl1LGZ546EjpYGHs+Jy12NL2hB/MBfl4EizkCkFnfR8t9sXb5H3pRB6UsU2F8eGpEPI300nL9eZyLDBMzoj4QFMBsfH5jGBz5jE9oRXLZM+GaysGdWD3xpBow4Jxz4UtCnkb1ZNVBWm88aCL0cyM383NHyKXyF3cWVJQ= ARC-Message-Signature: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1752383995; c=relaxed/simple; bh=8js91IgVYsC8Fy0R0aj0rczYZJdglhoK86obU86UhJQ=; h=DKIM-Signature:From:To:Subject:Date:Message-ID:MIME-Version; b=BbfcuhqJSBV2JArOJ3jOV4nrUMeIXL0IWB7+bkxK0wimJ5Bj8w/De9dt4SIgbLfurRUTP/90mXtYzUJyfZUu8MRQiv4G70sB7N0RModckPyQ2ZR/EadWigE+Y/m4YwsZZXHZ7qx9xVjiIUW32E4JRUnn0HZGs0iOc80QZn+gsu4= ARC-Authentication-Results: i=1; server2.sourceware.org DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 914FA3858C66 Received: from mail.zytor.com ([IPv6:2601:646:8081:9482:5253:b53:6783:9834]) (authenticated bits=0) by mail.zytor.com (8.18.1/8.17.1) with ESMTPSA id 56D5Jokp2268726 (version=TLSv1.3 cipher=TLS_AES_256_GCM_SHA384 bits=256 verify=NO); Sat, 12 Jul 2025 22:19:53 -0700 DKIM-Filter: OpenDKIM Filter v2.11.0 mail.zytor.com 56D5Jokp2268726 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=zytor.com; s=2025062101; t=1752383993; bh=S4jcNrUjIuS6Va+A+eNS+JzqwNoXkQJ15DHe9ksHJvw=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=B5tWvZiwOJHr2ZSxekrExZMqwbRitmaqteaXxGg+PPZJ/KzAfkxxNL2Ow18nmoG4e q9eEegZTW6m5hwJo4CYfBp5NY1Yjeuci2fxFOauASWcScDjhDqurVKteckC05G5F3y wTDYZiDhrbNtG7SUzVUFtqufrezjzrwNVCmLBa/TDsrqVJMYO501yzhDAtsk3bFrDf ewgL/WIT4PD0FkXuYwGei51k2/H10jOrF76Hm2FM7JUKxkt6NUA+U57pp0RAOPAvLH jXrNl0qjjLOlsj+ppt4Yuo2Q2j0ROyowiNfurZOQZ+Ltlrlbqsvc3oxwzN4BC0Ayez SZFORC85f+z9Q== From: "H. Peter Anvin" To: GNU C Library Cc: Adhemerval Zanella Netto , Collin Funk , "H. Peter Anvin" Subject: [PATCH v4 3/3] termios: manual: document the SPEED_MAX and BAUD_MAX constants Date: Sat, 12 Jul 2025 22:19:44 -0700 Message-ID: <20250713051944.782970-4-hpa@zytor.com> X-Mailer: git-send-email 2.50.1 In-Reply-To: <20250713051944.782970-1-hpa@zytor.com> References: <20250713051944.782970-1-hpa@zytor.com> MIME-Version: 1.0 X-Spam-Status: No, score=-12.0 required=5.0 tests=BAYES_00, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, DKIM_VALID_EF, GIT_PATCH_0, SPF_HELO_PASS, SPF_PASS, TXREP autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on server2.sourceware.org X-BeenThere: libc-alpha@sourceware.org X-Mailman-Version: 2.1.30 Precedence: list List-Id: Libc-alpha mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: libc-alpha-bounces~patchwork=sourceware.org@sourceware.org Add the SPEED_MAX and BAUD_MAX constants to the manual. [ v3: drop leading underscores ] Signed-off-by: "H. Peter Anvin" (Intel) Reviewed-by: Collin Funk --- manual/terminal.texi | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) diff --git a/manual/terminal.texi b/manual/terminal.texi index b43231b8bf2a..805b408fb2cb 100644 --- a/manual/terminal.texi +++ b/manual/terminal.texi @@ -1264,6 +1264,17 @@ BSD defines two additional speed symbols as aliases: @code{EXTA} is an alias for @code{B19200} and @code{EXTB} is an alias for @code{B38400}. These aliases are obsolete. +@deftypevr Macro speed_t SPEED_MAX +@standards{GNU, termios.h} + +@theglibc{} defines the constant @code{SPEED_MAX} for the largest valid +value of type @code{speed_t}. This value may be smaller than the +underlying C type can store. + +For compatiblity with some other platforms the alias @code{__MAX_BAUD} +is defined for this constant. +@end deftypevr + @deftypefun speed_t cfgetospeed (const struct termios *@var{termios-p}) @standards{POSIX.1, termios.h} @safety{@prelim{}@mtsafe{}@assafe{}@acsafe{}} @@ -1347,6 +1358,13 @@ may not be the case in future versions or on other implementations; it is specifically not guaranteed to be an integer type. @end deftp +@deftypevr Macro baud_t BAUD_MAX +@standards{GNU, termios.h} +The constant @code{BAUD_MAX} is defined to the maximum valid value of +type @code{baud_t}. This value may be smaller than the underlying C +type can store. +@end deftypevr + @deftypefun baud_t cfgetobaud (const struct termios *@var{termios-p}) @standards{GNU, termios.h} @safety{@prelim{}@mtsafe{}@assafe{}@acsafe{}}