From nobody Tue Apr 23 19:44:23 2024 X-Original-To: dev-commits-src-main@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 4VPCHW5RxVz5HxL7; Tue, 23 Apr 2024 19:44:23 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4VPCHW2Qnqz4h8r; Tue, 23 Apr 2024 19:44:23 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1713901463; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=NyqU+DDEdDNB2MkD106/HGB55s7ukJn4xxCQamdfsZM=; b=AwBJAVln/H0977MDQ1oB/WuPye7+JCS1ZDWs/xFyEmX6xj7M4KqmCnimoRJpWKv5gNU2+p NdLM2fs6Ou8JpzFEncHyUuMFZj8iPxv88D90gdI+jOwuDpNUCVFQSd6ovEfO2W2yRqY9Sq 3VVNpDsbxxXhVj69SFF1BCP1SDPWHMqUyEKtsAfDod7vGdH+ie+ASxLnVyOD3sPr1efILn vVLvfYYrfdoBQG1JdntxV9xugHswtPBBSNHaeSmPaClC9Bz3ZNSf1Hi8ZmJhxnyc/fFf4S ks6uKwqww7MiUaXP85ZZq+yx9oxbFA20pchul1hBWHr+8d3y7owhceSyLbm1LQ== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1713901463; a=rsa-sha256; cv=none; b=G6X2aLUl/aeLFP8S16ymUNZa5n/1GG4VNfLEOvS8DipSQR8raVtke9T6vdKE3NqTCL7oYU E8c1v7Zlv+1SN5G0g+PLqhL77PzCaAulW7CzHzKjnh76ZRINP/d5doni13t7OA6H8uB4Bz 7wwAbis2JTo0KXsS1/SuXKhZbOk0F81SSIU4sElqXVkzPeszuT+XM9EnBmLqakbVRliULS 4q0FqpOThbCoxSH+Y04rusNlOvMCsx967lpGqtFQvUIJL9NJFv3FAkoZMaA0ZbH0p3IhOu Pex5V8iablm8L6hkiplc3JBidy0Ece8fZ9xv7IUKquBUymFvwGi+TfpIiAXsjw== ARC-Authentication-Results: i=1; mx1.freebsd.org; none ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1713901463; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=NyqU+DDEdDNB2MkD106/HGB55s7ukJn4xxCQamdfsZM=; b=QbzC927Y4/WT6xr8vVRc8VJvEeKpHerHe89S0li2dZPxx7DPKlIC5eLCXi40nZuCc/GNI6 wn7wwNI4FJFi3F79BKeUxxp5QPrdm7/BX+J0AR+w09EEMl57jC/oZTa2Qgz9FbPjGde3uM B3EbjRfmvE46V1vtUWX+XY4eDMs9Lr4yywDSDGcd2fR//3HpwMA/Cz0KlsAg6F4afOQfi4 SLx7VygME+rGGSuqt12VAEfQs6xCm8EKlmnHScp+9C2lY8MqPBWwJ7aGNv0LidTDd9Npt1 Kk3UfDTI+525x3TrtJfFO+GYKBgi4hrhGpAS05XFcQmoAULM1yFbHkf2gapkhg== Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 4VPCHW22rBzlMk; Tue, 23 Apr 2024 19:44:23 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.17.1/8.17.1) with ESMTP id 43NJiN8V077501; Tue, 23 Apr 2024 19:44:23 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.17.1/8.17.1/Submit) id 43NJiN85077498; Tue, 23 Apr 2024 19:44:23 GMT (envelope-from git) Date: Tue, 23 Apr 2024 19:44:23 GMT Message-Id: <202404231944.43NJiN85077498@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Konstantin Belousov Subject: git: 92771bc00ad0 - main - libc: make strerror_rl() usable for libc List-Id: Commit messages for the main branch of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-main List-Help: List-Post: List-Subscribe: List-Unsubscribe: X-BeenThere: dev-commits-src-main@freebsd.org Sender: owner-dev-commits-src-main@FreeBSD.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: kib X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 92771bc00ad0f567b27876c34450bef7a0ee61d0 Auto-Submitted: auto-generated The branch main has been updated by kib: URL: https://cgit.FreeBSD.org/src/commit/?id=92771bc00ad0f567b27876c34450bef7a0ee61d0 commit 92771bc00ad0f567b27876c34450bef7a0ee61d0 Author: Konstantin Belousov AuthorDate: 2024-04-23 17:04:29 +0000 Commit: Konstantin Belousov CommitDate: 2024-04-23 19:40:29 +0000 libc: make strerror_rl() usable for libc Reviewed by: imp Sponsored by: The FreeBSD Foundation MFC after: 1 week Differential revision: https://reviews.freebsd.org/D44916 --- lib/libc/include/libc_private.h | 2 ++ lib/libc/string/strerror.c | 10 +++++----- 2 files changed, 7 insertions(+), 5 deletions(-) diff --git a/lib/libc/include/libc_private.h b/lib/libc/include/libc_private.h index 73b22beffe88..2b16ce736e3a 100644 --- a/lib/libc/include/libc_private.h +++ b/lib/libc/include/libc_private.h @@ -374,5 +374,7 @@ struct __nl_cat_d; struct _xlocale; struct __nl_cat_d *__catopen_l(const char *name, int type, struct _xlocale *locale); +int __strerror_rl(int errnum, char *strerrbuf, size_t buflen, + struct _xlocale *locale); #endif /* _LIBC_PRIVATE_H_ */ diff --git a/lib/libc/string/strerror.c b/lib/libc/string/strerror.c index 69c9d1da69af..ecad55caa673 100644 --- a/lib/libc/string/strerror.c +++ b/lib/libc/string/strerror.c @@ -74,8 +74,8 @@ errstr(int num, const char *uprefix, char *buf, size_t len) strlcat(buf, t, len); } -static int -strerror_rl(int errnum, char *strerrbuf, size_t buflen, locale_t locale) +int +__strerror_rl(int errnum, char *strerrbuf, size_t buflen, locale_t locale) { int retval = 0; #if defined(NLS) @@ -116,7 +116,7 @@ strerror_rl(int errnum, char *strerrbuf, size_t buflen, locale_t locale) int strerror_r(int errnum, char *strerrbuf, size_t buflen) { - return (strerror_rl(errnum, strerrbuf, buflen, __get_locale())); + return (__strerror_rl(errnum, strerrbuf, buflen, __get_locale())); } char * @@ -124,7 +124,7 @@ strerror_l(int num, locale_t locale) { static _Thread_local char ebuf[NL_TEXTMAX]; - if (strerror_rl(num, ebuf, sizeof(ebuf), locale) != 0) + if (__strerror_rl(num, ebuf, sizeof(ebuf), locale) != 0) errno = EINVAL; return (ebuf); } @@ -134,7 +134,7 @@ strerror(int num) { static char ebuf[NL_TEXTMAX]; - if (strerror_rl(num, ebuf, sizeof(ebuf), __get_locale()) != 0) + if (__strerror_rl(num, ebuf, sizeof(ebuf), __get_locale()) != 0) errno = EINVAL; return (ebuf); }