From 249ea9925fc6cab53616b6e4f39a454a847dd373 Mon Sep 17 00:00:00 2001
From: schwarze <>
Date: Sat, 28 Apr 2018 15:28:25 +0000
Subject: Say that sethostent(3), gethostent(3), and endhostent(3) do nothing.
 While here, stop implying plans to support additional address families in the
 future, and do not call gethostbyname2(3) "advanced". OK deraadt@ guenther@

---
 src/lib/libc/net/gethostbyname.3 | 69 +++++++++++-----------------------------
 1 file changed, 19 insertions(+), 50 deletions(-)

(limited to 'src/lib')

diff --git a/src/lib/libc/net/gethostbyname.3 b/src/lib/libc/net/gethostbyname.3
index 8b8dc66952..251f363ff1 100644
--- a/src/lib/libc/net/gethostbyname.3
+++ b/src/lib/libc/net/gethostbyname.3
@@ -1,4 +1,4 @@
-.\"	$OpenBSD: gethostbyname.3,v 1.32 2016/08/05 16:16:06 schwarze Exp $
+.\"	$OpenBSD: gethostbyname.3,v 1.33 2018/04/28 15:28:25 schwarze Exp $
 .\"
 .\" Copyright (c) 1983, 1987, 1991, 1993
 .\"	The Regents of the University of California.  All rights reserved.
@@ -27,7 +27,7 @@
 .\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
 .\" SUCH DAMAGE.
 .\"
-.Dd $Mdocdate: August 5 2016 $
+.Dd $Mdocdate: April 28 2018 $
 .Dt GETHOSTBYNAME 3
 .Os
 .Sh NAME
@@ -124,14 +124,14 @@ and
 .Xr hostname 7 .
 .Pp
 .Fn gethostbyname2
-is an advanced form of
+is similar to
 .Fn gethostbyname
-which allows lookups in address families other than
+except that it supports an
+.Fa af
+of
+.Dv AF_INET6
+in addition to
 .Dv AF_INET .
-Currently, the only supported address family besides
-.Dv AF_INET
-is
-.Dv AF_INET6 .
 .Pp
 The
 .Fn gethostbyaddr
@@ -139,26 +139,19 @@ function will search for the specified address of length
 .Fa len
 in the address family
 .Fa af .
-The only address family currently supported is
+The only address family supported is
 .Dv AF_INET .
 .Pp
 The
-.Fn sethostent
-function may be used to request the use of a connected
-TCP socket for queries.
-If the
-.Fa stayopen
-flag is non-zero,
-this sets the option to send all queries to the name server using TCP
-and to retain the connection after each call to
-.Fn gethostbyname
-or
-.Fn gethostbyaddr .
-Otherwise, queries are performed using UDP datagrams.
-.Pp
-The
+.Fn sethostent ,
+.Fn gethostent ,
+and
 .Fn endhostent
-function closes the TCP connection.
+functions are deprecated and no longer have any effect.
+They could be used in the past for queries over a persistent TCP
+connection or to iterate entries in the
+.Xr hosts 5
+file.
 .Pp
 The
 .Fn herror
@@ -231,6 +224,8 @@ This may occur when an address family other than
 or
 .Dv AF_INET6
 is specified or when a resource is unable to be allocated.
+It is always set by
+.Fn gethostent .
 .It Dv NETDB_SUCCESS
 The function completed successfully.
 .El
@@ -262,32 +257,6 @@ and
 .Fn gethostbyname2
 in
 .Ox 2.1 .
-.Sh CAVEATS
-If the search routines in
-.Xr resolv.conf 5
-decide to read the
-.Pa /etc/hosts
-file,
-.Fn gethostent
-and other functions will
-read the next line of the file,
-re-opening the file if necessary.
-.Pp
-The
-.Fn sethostent
-function opens and/or rewinds the file
-.Pa /etc/hosts .
-If the
-.Fa stayopen
-argument is non-zero, the file will not be closed after each call to
-.Fn gethostbyname ,
-.Fn gethostbyname2 ,
-or
-.Fn gethostbyaddr .
-.Pp
-The
-.Fn endhostent
-function closes the file.
 .Sh BUGS
 These functions use static data storage;
 if the data is needed for future use, it should be
-- 
cgit v1.2.3-55-g6feb