summaryrefslogtreecommitdiff
path: root/src/lib/libc/net/gethostbyname.3
diff options
context:
space:
mode:
Diffstat (limited to '')
-rw-r--r--src/lib/libc/net/gethostbyname.358
1 files changed, 35 insertions, 23 deletions
diff --git a/src/lib/libc/net/gethostbyname.3 b/src/lib/libc/net/gethostbyname.3
index 3f737b4e97..8b8dc66952 100644
--- a/src/lib/libc/net/gethostbyname.3
+++ b/src/lib/libc/net/gethostbyname.3
@@ -1,4 +1,4 @@
1.\" $OpenBSD: gethostbyname.3,v 1.31 2016/08/05 07:54:15 martijn Exp $ 1.\" $OpenBSD: gethostbyname.3,v 1.32 2016/08/05 16:16:06 schwarze Exp $
2.\" 2.\"
3.\" Copyright (c) 1983, 1987, 1991, 1993 3.\" Copyright (c) 1983, 1987, 1991, 1993
4.\" The Regents of the University of California. All rights reserved. 4.\" The Regents of the University of California. All rights reserved.
@@ -68,7 +68,11 @@ The
68and 68and
69.Fn gethostbyaddr 69.Fn gethostbyaddr
70functions each return a pointer to an object with the following structure 70functions each return a pointer to an object with the following structure
71describing an Internet host referenced by name or by address, respectively. 71describing an Internet host referenced by
72.Fa name
73or
74.Fa addr ,
75respectively.
72This structure contains either information obtained from a name server, 76This structure contains either information obtained from a name server,
73broken-out fields from a line in 77broken-out fields from a line in
74.Pa /etc/hosts , 78.Pa /etc/hosts ,
@@ -93,13 +97,17 @@ The members of this structure are:
93.It Fa h_name 97.It Fa h_name
94Official name of the host. 98Official name of the host.
95.It Fa h_aliases 99.It Fa h_aliases
96A null-terminated array of alternate names for the host. 100A
101.Dv NULL Ns -terminated
102array of alternate names for the host.
97.It Fa h_addrtype 103.It Fa h_addrtype
98The type of address being returned. 104The type of address being returned.
99.It Fa h_length 105.It Fa h_length
100The length, in bytes, of the address. 106The length, in bytes, of the address.
101.It Fa h_addr_list 107.It Fa h_addr_list
102A null-terminated array of network addresses for the host. 108A
109.Dv NULL Ns -terminated
110array of network addresses for the host.
103Host addresses are returned in network byte order. 111Host addresses are returned in network byte order.
104.It Fa h_addr 112.It Fa h_addr
105The first address in 113The first address in
@@ -137,33 +145,28 @@ The only address family currently supported is
137The 145The
138.Fn sethostent 146.Fn sethostent
139function may be used to request the use of a connected 147function may be used to request the use of a connected
140.Tn TCP 148TCP socket for queries.
141socket for queries.
142If the 149If the
143.Fa stayopen 150.Fa stayopen
144flag is non-zero, 151flag is non-zero,
145this sets the option to send all queries to the name server using 152this sets the option to send all queries to the name server using TCP
146.Tn TCP
147and to retain the connection after each call to 153and to retain the connection after each call to
148.Fn gethostbyname 154.Fn gethostbyname
149or 155or
150.Fn gethostbyaddr . 156.Fn gethostbyaddr .
151Otherwise, queries are performed using 157Otherwise, queries are performed using UDP datagrams.
152.Tn UDP
153datagrams.
154.Pp 158.Pp
155The 159The
156.Fn endhostent 160.Fn endhostent
157function closes the 161function closes the TCP connection.
158.Tn TCP
159connection.
160.Pp 162.Pp
161The 163The
162.Fn herror 164.Fn herror
163function prints an error message describing the failure. 165function prints an error message describing the failure.
164If its argument 166If its argument
165.Fa string 167.Fa string
166is non-null, 168is not
169.Dv NULL ,
167it is prepended to the message string and separated from it by a colon 170it is prepended to the message string and separated from it by a colon
168.Pq Ql \&: 171.Pq Ql \&:
169and a space. 172and a space.
@@ -171,10 +174,10 @@ The error message is printed with a trailing newline.
171The contents of the error message is the same as that returned by 174The contents of the error message is the same as that returned by
172.Fn hstrerror 175.Fn hstrerror
173with argument 176with argument
174.Fa h_errno . 177.Va h_errno .
175.Sh ENVIRONMENT 178.Sh ENVIRONMENT
176.Bl -tag -width RES_OPTIONS 179.Bl -tag -width RES_OPTIONS
177.It RES_OPTIONS 180.It Ev RES_OPTIONS
178A list of options to override the resolver's internal defaults. 181A list of options to override the resolver's internal defaults.
179See 182See
180.Xr resolv.conf 5 183.Xr resolv.conf 5
@@ -191,7 +194,9 @@ Error return status from
191.Fn gethostbyname2 , 194.Fn gethostbyname2 ,
192and 195and
193.Fn gethostbyaddr 196.Fn gethostbyaddr
194is indicated by return of a null pointer. 197is indicated by return of a
198.Dv NULL
199pointer.
195The external integer 200The external integer
196.Va h_errno 201.Va h_errno
197may then be checked to see whether this is a temporary failure 202may then be checked to see whether this is a temporary failure
@@ -238,10 +243,6 @@ The function completed successfully.
238.Xr hostname 7 243.Xr hostname 7
239.Sh HISTORY 244.Sh HISTORY
240The 245The
241.Fn herror
242function appeared in
243.Bx 4.3 .
244The
245.Fn endhostent , 246.Fn endhostent ,
246.Fn gethostbyaddr , 247.Fn gethostbyaddr ,
247.Fn gethostbyname , 248.Fn gethostbyname ,
@@ -249,7 +250,18 @@ The
249and 250and
250.Fn sethostent 251.Fn sethostent
251functions appeared in 252functions appeared in
252.Bx 4.2 . 253.Bx 4.1c .
254The function
255.Fn herror
256was added in
257.Bx 4.3 Tahoe ,
258.Fn hstrerror
259in
260.Bx 4.4 ,
261and
262.Fn gethostbyname2
263in
264.Ox 2.1 .
253.Sh CAVEATS 265.Sh CAVEATS
254If the search routines in 266If the search routines in
255.Xr resolv.conf 5 267.Xr resolv.conf 5