Page MenuHomeFreeBSD

D30385.diff
No OneTemporary

D30385.diff

diff --git a/lib/libc/net/Makefile.inc b/lib/libc/net/Makefile.inc
--- a/lib/libc/net/Makefile.inc
+++ b/lib/libc/net/Makefile.inc
@@ -67,7 +67,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 \
diff --git a/lib/libc/net/getnetent.3 b/lib/libc/net/getnetent.3
--- 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 @@
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

File Metadata

Mime Type
text/plain
Expires
Fri, Jul 17, 2:36 AM (56 m, 31 s)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
35155760
Default Alt Text
D30385.diff (2 KB)

Event Timeline