From nobody Mon Jun 20 05:30:41 2022 X-Original-To: dev-commits-src-all@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 23A8E85A31B; Mon, 20 Jun 2022 05:30:42 +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 4LRJC60NHcz4X3f; Mon, 20 Jun 2022 05:30:42 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1655703042; 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=tPMIvzCkEsabQQ9iEmin+bpQUxqATqURvOqDoMEONGg=; b=Izjzj75tLI+BRyZs6E9LmnClnh/Z3wFD4O3cXyclpPyiQVkaS4DiJeuzvmOVUsQqVn3LBF OcabBOVAroFl1DCO15S+KeauvTfn6qD/ivWdD3cGZgeKY5E8be8TrZpSvwiC1uF5PrZBHp pBKCkyvs6Oz+n9SGmYIGlvE9aOH5Qvd6gl4Jx51DQYUmaGejp9RSxfGQfeJsI0a7HFowQz cJbjijM8xgx8aU2TkGN6UeGUudsytHqt+e/FZzAiojsY9s9nZ+LNA/RzXbLd3wDHWHBNqQ dCQTGbvJxt3OcFUItjGQnvzHtUS5LM7qApJxN+wXY/gK/patR77gYHhiveqFXw== 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 E10501725B; Mon, 20 Jun 2022 05:30:41 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 25K5UfuT013957; Mon, 20 Jun 2022 05:30:41 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 25K5Uf6t013956; Mon, 20 Jun 2022 05:30:41 GMT (envelope-from git) Date: Mon, 20 Jun 2022 05:30:41 GMT Message-Id: <202206200530.25K5Uf6t013956@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: =?utf-8?Q?Fernando=20Apestegu=C3=ADa?= Subject: git: dc68997328ec - main - getnetent(3): Add missing reentrant functions List-Id: Commit messages for all branches of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-all List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-dev-commits-src-all@freebsd.org X-BeenThere: dev-commits-src-all@freebsd.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: fernape X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: dc68997328ec6cec41ad3b818c1846c8217e0c68 Auto-Submitted: auto-generated ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1655703042; 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=tPMIvzCkEsabQQ9iEmin+bpQUxqATqURvOqDoMEONGg=; b=MhSzLXFJyfhPeTW32oaJ+YBNDp8DzsO5XnuDjhXNLZLE99f53Ap52rGYGgjvhbeYl375eo nuyjnG1zUuB4UQWz6rGFu9CQWbb3agdXI3baVV6tHCAVq/iXi/QIQBKBevqqfgM0mIPTqj WX95M1bc4mVB6d/xt5J5lH8FQfTyRmZ7C2Y85JeJtoDirnYDbOM8wBmXZeiRtUNvE74wWA HC5ZifCv3Xeqs1BTTpHQ4VvSrDL67ZXmodNhAZEMqx0DtLFlnBnwulGrNdA5Sh5y3DRzvs 6RsFK3eWf55ay/zoeqH+zddwztNVnol8VffuWDttfCHmGKFzi7MZSoDQM/0wKw== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1655703042; a=rsa-sha256; cv=none; b=PaBHs0m6S6fnKpJzA3l5ke9gGiUVzJeie0FnDVDKXyhDada/CsCNkQRO0yjynqfw115TKt Dp0Dn36XfWxasGsKLNF4kq6UCY1Wr9bJn6Ek66fO4tAo/XfFxgUYLzw/ZA3cu9tGgpykZ3 N8eHCAnfQDOGIjWv/vn6CSK2kV6ZRS8AfrO0nNSbDlHNLOcGO9SPA2EUSByt7SwLCka5D9 c/ahqRKhWQy3jK16uByUum7SQ1juB87xQHdm5jDtDtooA2EdcFvsDkcQUJcftPhFvgAXoj SvDUN7rH66MU4bDrFeZQ7V2qrlgjYMdllJzzTiDuwLTaYVzlPlUxv01kGOmIXg== ARC-Authentication-Results: i=1; mx1.freebsd.org; none X-ThisMailContainsUnwantedMimeParts: N The branch main has been updated by fernape (doc, ports committer): URL: https://cgit.FreeBSD.org/src/commit/?id=dc68997328ec6cec41ad3b818c1846c8217e0c68 commit dc68997328ec6cec41ad3b818c1846c8217e0c68 Author: Fernando ApesteguĂ­a AuthorDate: 2021-05-21 15:25:25 +0000 Commit: Fernando ApesteguĂ­a CommitDate: 2022-06-20 05:23:53 +0000 getnetent(3): Add missing reentrant functions Add documentation for gethostbyname_r, gethostbyname2_r and gethostbyaddr_r Create proper MLINKs for the new functions. PR: 249154 Reported by: asomers@ Approved by: manpages (0mp@), Pau Amma Differential Revision: https://reviews.freebsd.org/D30469 --- lib/libc/net/Makefile.inc | 7 ++++--- lib/libc/net/gethostbyname.3 | 33 +++++++++++++++++++++++++++++++-- 2 files changed, 35 insertions(+), 5 deletions(-) diff --git a/lib/libc/net/Makefile.inc b/lib/libc/net/Makefile.inc index 6628028ccc83..683e2826c401 100644 --- a/lib/libc/net/Makefile.inc +++ b/lib/libc/net/Makefile.inc @@ -59,9 +59,10 @@ MLINKS+=eui64.3 eui64_aton.3 eui64.3 eui64_hostton.3 \ eui64.3 eui64_ntoa.3 eui64.3 eui64_ntohost.3 MLINKS+=getaddrinfo.3 freeaddrinfo.3 MLINKS+=gethostbyname.3 endhostent.3 gethostbyname.3 gethostbyaddr.3 \ - gethostbyname.3 gethostbyname2.3 gethostbyname.3 gethostent.3 \ - gethostbyname.3 herror.3 gethostbyname.3 hstrerror.3 \ - gethostbyname.3 sethostent.3 + gethostbyname.3 gethostbyaddr_r.3 gethostbyname.3 gethostbyname2.3 \ + gethostbyname.3 gethostbyname2_r.3 gethostbyname.3 gethostbyname_r.3 \ + gethostbyname.3 gethostent.3 gethostbyname.3 herror.3 \ + gethostbyname.3 hstrerror.3 gethostbyname.3 sethostent.3 MLINKS+=getifaddrs.3 freeifaddrs.3 MLINKS+=getifmaddrs.3 freeifmaddrs.3 MLINKS+=getipnodebyname.3 getipnodebyaddr.3 getipnodebyname.3 freehostent.3 diff --git a/lib/libc/net/gethostbyname.3 b/lib/libc/net/gethostbyname.3 index 8a624e90cbdc..883e033971fb 100644 --- a/lib/libc/net/gethostbyname.3 +++ b/lib/libc/net/gethostbyname.3 @@ -28,7 +28,7 @@ .\" From: @(#)gethostbyname.3 8.4 (Berkeley) 5/25/95 .\" $FreeBSD$ .\" -.Dd October 4, 2017 +.Dd June 20, 2022 .Dt GETHOSTBYNAME 3 .Os .Sh NAME @@ -39,7 +39,10 @@ .Nm sethostent , .Nm endhostent , .Nm herror , -.Nm hstrerror +.Nm hstrerror , +.Nm gethostbyname_r , +.Nm gethostbyname2_r , +.Nm gethostbyaddr_r .Nd get network host entry .Sh LIBRARY .Lb libc @@ -62,6 +65,12 @@ .Fn herror "const char *string" .Ft const char * .Fn hstrerror "int err" +.Ft int +.Fn gethostbyname_r "const char *name" "struct hostent *he" "char *buffer" "size_t buflen" "struct hostent **result" "int *h_errnop" +.Ft int +.Fn gethostbyname2_r "const char *name" "int af" "struct hostent *he" "char *buffer" "size_t buflen" "struct hostent **result" "int *h_errnop" +.Ft int +.Fn gethostbyaddr_r "const void *addr" "socklen_t len" "int af" "struct hostent *hp" "char *buf" "size_t buflen" "struct hostent **result" "int *h_errno"p .Sh DESCRIPTION .Bf -symbolic The @@ -227,6 +236,26 @@ function returns a string which is the message text corresponding to the value of the .Fa err argument. +.Pp +Functions with the +.Em _r +suffix provide reentrant versions of their respective counterparts. +The caller must supply five additional parameters: a +.Vt struct hostent +variable to be filled on success, a +.Va buffer +of +.Va buflen +bytes in size, a +.Vt struct hostent +.Va result +variable that will point to the result on success or be set to +.Dv NULL +on failure or if the name is not found. +The +.Va h_errnop +variable will be filled with the error code if any. +All these functions return 0 on success. .Sh FILES .Bl -tag -width /etc/nsswitch.conf -compact .It Pa /etc/hosts