git: 9acb1d7b2c93 - main - getnetent(3): Add documentation for missing reentrant functions
- Go to: [ bottom of page ] [ top of archives ] [ this month ]
Date: Mon, 20 Jun 2022 05:39:48 UTC
The branch main has been updated by fernape (doc, ports committer): URL: https://cgit.FreeBSD.org/src/commit/?id=9acb1d7b2c932c48c64345c589c0e0733c7918fd commit 9acb1d7b2c932c48c64345c589c0e0733c7918fd Author: Fernando Apesteguía <fernape@FreeBSD.org> AuthorDate: 2021-05-26 12:34:49 +0000 Commit: Fernando Apesteguía <fernape@FreeBSD.org> CommitDate: 2022-06-20 05:30:38 +0000 getnetent(3): Add documentation for missing reentrant functions Add gethostbyname_r, gethostbyname2_r and gethostbyaddr_r signatures and descriptions. PR: 249154 Reported by: asomers@ Approved by: manpages (imp@), Pau Amma Differential Revision: https://reviews.freebsd.org/D30385 --- lib/libc/net/Makefile.inc | 4 +++- lib/libc/net/getnetent.3 | 28 +++++++++++++++++++++++++++- 2 files changed, 30 insertions(+), 2 deletions(-) diff --git a/lib/libc/net/Makefile.inc b/lib/libc/net/Makefile.inc index 683e2826c401..755d44e6c5dd 100644 --- a/lib/libc/net/Makefile.inc +++ b/lib/libc/net/Makefile.inc @@ -67,7 +67,9 @@ MLINKS+=getifaddrs.3 freeifaddrs.3 MLINKS+=getifmaddrs.3 freeifmaddrs.3 MLINKS+=getipnodebyname.3 getipnodebyaddr.3 getipnodebyname.3 freehostent.3 MLINKS+=getnetent.3 endnetent.3 getnetent.3 getnetbyaddr.3 \ - getnetent.3 getnetbyname.3 getnetent.3 setnetent.3 + getnetent.3 getnetbyaddr_r.3 getnetent.3 getnetbyname.3 \ + getnetent.3 getnetbyname_r.3 getnetent.3 setnetent.3 \ + getnetent.3 getnetent_r.3 MLINKS+=getprotoent.3 endprotoent.3 getprotoent.3 getprotobyname.3 \ getprotoent.3 getprotobynumber.3 getprotoent.3 setprotoent.3 MLINKS+=getservent.3 endservent.3 getservent.3 getservbyname.3 \ diff --git a/lib/libc/net/getnetent.3 b/lib/libc/net/getnetent.3 index adf2760d132f..29eabdacd6bf 100644 --- a/lib/libc/net/getnetent.3 +++ b/lib/libc/net/getnetent.3 @@ -28,7 +28,7 @@ .\" @(#)getnetent.3 8.1 (Berkeley) 6/4/93 .\" $FreeBSD$ .\" -.Dd June 4, 1993 +.Dd June 20, 2022 .Dt GETNETENT 3 .Os .Sh NAME @@ -52,6 +52,12 @@ .Fn setnetent "int stayopen" .Ft void .Fn endnetent void +.Ft int +.Fn getnetent_r "struct netent *ne" "char *buffer" "size_t buflen" "struct netent **result" "int *h_errnop" +.Ft int +.Fn getnetbyaddr_r "uint32_t net" "int type" "struct netent *ne" "char *buffer" "size_t buflen" "struct netent **result" int *h_errorp" +.Ft int +.Fn getnetbyname_r "const char *name" "struct netent *ne" "char *buffer" "size_t buflen" "struct netent **result" "int *h_errorp" .Sh DESCRIPTION The .Fn getnetent , @@ -135,6 +141,26 @@ argument must be .Dv AF_INET . Network numbers are supplied in host order. +.Pp +Functions with the +.Em _r +suffix provide reentrant versions of their respective counterparts. +The caller must supply five additional parameters: a +.Vt struct netent +variable to be filled on success, a +.Va buffer +of +.Va buflen +bytes in size, a +.Vt struct netent +.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/networks