Index: lib/libc/net/Makefile.inc =================================================================== --- lib/libc/net/Makefile.inc +++ lib/libc/net/Makefile.inc @@ -66,7 +66,9 @@ 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 \ Index: lib/libc/net/getnetent.3 =================================================================== --- lib/libc/net/getnetent.3 +++ lib/libc/net/getnetent.3 @@ -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 @@ 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