From patchwork Tue Jun 3 05:43:16 2025 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Marcus Haehnel X-Patchwork-Id: 2093267 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@legolas.ozlabs.org Authentication-Results: legolas.ozlabs.org; dkim=fail reason="signature verification failed" (2048-bit key; unprotected) header.d=kernkonzept.com header.i=@kernkonzept.com header.a=rsa-sha256 header.s=mx1 header.b=fAlLAl+Z; dkim-atps=neutral Authentication-Results: legolas.ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=uclibc-ng.org (client-ip=89.238.66.15; helo=helium.openadk.org; envelope-from=devel-bounces@uclibc-ng.org; receiver=patchwork.ozlabs.org) Received: from helium.openadk.org (helium.openadk.org [89.238.66.15]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (secp384r1) server-digest SHA384) (No client certificate requested) by legolas.ozlabs.org (Postfix) with ESMTPS id 4bBKR00z8wz1yFb for ; Tue, 3 Jun 2025 15:44:26 +1000 (AEST) Authentication-Results: helium.openadk.org; dkim=fail reason="signature verification failed" (2048-bit key; unprotected) header.d=kernkonzept.com header.i=@kernkonzept.com header.a=rsa-sha256 header.s=mx1 header.b=fAlLAl+Z; dkim-atps=neutral Received: from helium.openadk.org (localhost [IPv6:::1]) by helium.openadk.org (Postfix) with ESMTP id 18F083537EB3; Tue, 3 Jun 2025 07:44:31 +0200 (CEST) Received: from mx.kernkonzept.com (serv1.kernkonzept.com [159.69.200.6]) by helium.openadk.org (Postfix) with ESMTPS id 545C035356F7 for ; Tue, 3 Jun 2025 07:44:06 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=kernkonzept.com; s=mx1; h=Content-Transfer-Encoding:MIME-Version:Message-ID :Date:Subject:Cc:To:From:References:In-Reply-To:Reply-To:Content-Type: Content-ID:Content-Description; bh=nQ/HWHUOCDwplOgEwgy0LicWKdhKYUqvgXFCzN8FJe8=; b=fAlLAl+ZkDDY8BJB3ePwHhjXmB 6nELes59JKLAauK+4JoY1gzk5fIR09iUFc0Y+fmb1h4RmL8D1TSRRuqx3I60rCn2SSxkAKvvQ1/AW 8d8Z5ccIzOQ2oAHaQKhxYFcZW63EyqX/YonGhkg96PVqUSYB6GKrEXMJftWRiHSagx41D0oSItmmn icfqNkg9RfuPIQvv0B1tFHIVqTaSe6r7Qah8I8YObzoglIinskZohbgxxjezHynWLVwqVqIb1sumX 7XR7BHDDCWBX5Ec+150Lajpi/A4ii79lNvWqEI3eIMZ3UxC2yCZvyAVetvuDRkV+4Km4+Qa3iihGW R+cOjADg==; Received: from [10.22.3.160] (helo=amethyst.dd1.int.kernkonzept.com) by mx.kernkonzept.com with esmtpsa (TLS1.3:ECDHE_X25519__RSA_PSS_RSAE_SHA256__AES_256_GCM:256) (Exim 4.96) id 1uMKRR-00EWqB-26; Tue, 03 Jun 2025 07:44:05 +0200 From: Marcus Haehnel To: devel@uclibc-ng.org Date: Tue, 3 Jun 2025 07:43:16 +0200 Message-ID: <20250603054350.12533-1-marcus.haehnel@kernkonzept.com> X-Mailer: git-send-email 2.47.1 MIME-Version: 1.0 Message-ID-Hash: EIRSFWCEJH6CUHRCCPXHEMJUGPA3QIGI X-Message-ID-Hash: EIRSFWCEJH6CUHRCCPXHEMJUGPA3QIGI X-MailFrom: marcus.haehnel@kernkonzept.com X-Mailman-Rule-Misses: dmarc-mitigation; no-senders; approved; emergency; loop; banned-address; member-moderation; nonmember-moderation; administrivia; implicit-dest; max-recipients; max-size; news-moderation; no-subject; digests; suspicious-header CC: Marcus Haehnel X-Mailman-Version: 3.3.8 Precedence: list Subject: [uclibc-ng-devel] [PATCH] openpty/forkpty: use const for termios and winsize arguments List-Id: uClibc-ng Development Archived-At: List-Archive: List-Help: List-Owner: List-Post: List-Subscribe: List-Unsubscribe: The termios and winsize arguments are const as per the POSIX standard, and also uclibc and musl define them as such. Adapt the uclibc-ng definitions and declarations accordingly to improve compatibility. Signed-off-by: Marcus Haehnel --- include/pty.h | 6 ++++-- libutil/forkpty.c | 3 ++- libutil/openpty.c | 4 ++-- 3 files changed, 8 insertions(+), 5 deletions(-) diff --git a/include/pty.h b/include/pty.h index f23a260ae..609ac2459 100644 --- a/include/pty.h +++ b/include/pty.h @@ -31,13 +31,15 @@ __BEGIN_DECLS attributes according to TERMP and WINP and return handles for both ends in AMASTER and ASLAVE. */ extern int openpty (int *__amaster, int *__aslave, char *__name, - struct termios *__termp, struct winsize *__winp) __THROW; + const struct termios *__termp, + const struct winsize *__winp) __THROW; libutil_hidden_proto(openpty) /* Create child process and establish the slave pseudo terminal as the child's controlling terminal. */ extern int forkpty (int *__amaster, char *__name, - struct termios *__termp, struct winsize *__winp) __THROW; + const struct termios *__termp, + const struct winsize *__winp) __THROW; __END_DECLS diff --git a/libutil/forkpty.c b/libutil/forkpty.c index 24643330c..7e42d1a33 100644 --- a/libutil/forkpty.c +++ b/libutil/forkpty.c @@ -23,7 +23,8 @@ #include int -forkpty (int *amaster, char *name, struct termios *termp, struct winsize *winp) +forkpty (int *amaster, char *name, const struct termios *termp, + const struct winsize *winp) { int master, slave, pid; diff --git a/libutil/openpty.c b/libutil/openpty.c index 848dc8d38..e14cbc57d 100644 --- a/libutil/openpty.c +++ b/libutil/openpty.c @@ -85,8 +85,8 @@ pts_name (int fd, char **pts, size_t buf_len) according to TERMP and WINP. Return handles for both ends in AMASTER and ASLAVE, and return the name of the slave end in NAME. */ int -openpty (int *amaster, int *aslave, char *name, struct termios *termp, - struct winsize *winp) +openpty (int *amaster, int *aslave, char *name, const struct termios *termp, + const struct winsize *winp) { #if 0 #ifdef PATH_MAX