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
This commit is contained in:
Fernando Apesteguía 2021-05-26 14:34:49 +02:00
parent dc68997328
commit 9acb1d7b2c
2 changed files with 30 additions and 2 deletions

View File

@ -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 \

View File

@ -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