From patchwork Sun Jun 29 16:16:31 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: 115260 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 08C173852FDB for ; Sun, 29 Jun 2025 16:19:22 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 08C173852FDB 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=XNuwgBsE 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 369C33852FDE for ; Sun, 29 Jun 2025 16:16:41 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org 369C33852FDE 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 369C33852FDE 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=1751213801; cv=none; b=gvJyTYOKerUVZVI7rYLyp+wpQOEWK+AW2XITT/BowODvywlp0UyKAIWW4u7fN6fu6qiAk3CxQ0xx07w5tY+IhlkqXuMckH7OgU9cSTBtOw7sebFW4YEWuZElRGjh1X+qmhu4zjsaXSiGsg2nu6xjBpSZjPEfsaofzuW39OmddJk= ARC-Message-Signature: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1751213801; c=relaxed/simple; bh=HuR9Pul3DYhiQSNnnOSe7GxMwQ2Y2yDriU56fKQb3Z8=; h=DKIM-Signature:From:To:Subject:Date:Message-ID:MIME-Version; b=hTHLCuSNi9XeSSlNTmW9ni1honpmemSohOhkL6/1d9fMDGmgXXrXLzAZGKJeajwWecmD3hLOXOMAxEkS7K6FdV6I6yG//1ZSXRWFHpwqsnkyLXSHISaCfKaZq3F63tmNz5BwPn0/bn+Y2UHWCwN1A8/w7gdY4Q/XuWAcgIddkbE= ARC-Authentication-Results: i=1; server2.sourceware.org DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 369C33852FDE Received: from mail.zytor.com ([IPv6:2601:646:8081:9482:ef13:4515:a701:e3bb]) (authenticated bits=0) by mail.zytor.com (8.18.1/8.17.1) with ESMTPSA id 55TGGcKp3515149 (version=TLSv1.3 cipher=TLS_AES_256_GCM_SHA384 bits=256 verify=NO); Sun, 29 Jun 2025 09:16:40 -0700 DKIM-Filter: OpenDKIM Filter v2.11.0 mail.zytor.com 55TGGcKp3515149 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=zytor.com; s=2025062101; t=1751213800; bh=zEqgJJAn4334UACjbKnrHfWQD6P7TKoPESZP6srdVtI=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=XNuwgBsEH8iwtb62X3DrL8GEOGueZ7vUerSj2LJCV8xm71/jAXuQQAPhmCnwlx9Al svmW1jTuERErnMtk91CS0gYbAGJsmrIIDuT98hipyjVCrJtubrPhcWt5kl27ASCqsU 6NKztpKbt1WP6d6xp17YUoXj1HHF/JdT0mlLFWsfv4eIYXqY+IxKr8ME1TlFxxVjwo 2vtbVR2R7SObXzituh0qOc+UbEv9FIWjyNj7UejgTcRcCbbe1ZP17ssM6SLWbgB+zJ 7AEoA70SK5Op60aV00J5Mg+DjKsHQsyh9IiFDIkQK97W0HFJ7ur6B3QpA4oVUaPGzD d9oFrKJ9FiZVQ== From: "H. Peter Anvin" To: libc-alpha@sourceware.org Cc: "H. Peter Anvin" Subject: [PATCH v2 4/5] termios: _SPEED_MAX and _BAUD_MAX constants Date: Sun, 29 Jun 2025 09:16:31 -0700 Message-ID: <20250629161632.581628-5-hpa@zytor.com> X-Mailer: git-send-email 2.50.0 In-Reply-To: <20250629161632.581628-1-hpa@zytor.com> References: <20250629161632.581628-1-hpa@zytor.com> MIME-Version: 1.0 X-Spam-Status: No, score=-12.1 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 would imply 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), but add an underscore to the front to avoid stomping on the application namespace. Furthermore, move __MAX_BAUD under __USE_MISC as it is not a standardized symbol. Signed-off-by: "H. Peter Anvin" (Intel) --- 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..b751a7d4064b 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_MISC +#define _SPEED_MAX 4294967295U /* maximum valid speed_t value */ +#define __MAX_BAUD _SPEED_MAX /* legacy alias for _SPEED_MAX */ +#endif diff --git a/termios/termios.h b/termios/termios.h index 788c98240596..15ea29f95c82 100644 --- a/termios/termios.h +++ b/termios/termios.h @@ -62,6 +62,7 @@ extern int cfsetspeed (struct termios *__termios_p, speed_t __speed) __THROW; /* 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;