summaryrefslogtreecommitdiff
path: root/src/lib/libc/net/getaddrinfo.3
diff options
context:
space:
mode:
Diffstat (limited to 'src/lib/libc/net/getaddrinfo.3')
-rw-r--r--src/lib/libc/net/getaddrinfo.330
1 files changed, 15 insertions, 15 deletions
diff --git a/src/lib/libc/net/getaddrinfo.3 b/src/lib/libc/net/getaddrinfo.3
index 035db2780b..780c7a409f 100644
--- a/src/lib/libc/net/getaddrinfo.3
+++ b/src/lib/libc/net/getaddrinfo.3
@@ -1,4 +1,4 @@
1.\" $OpenBSD: getaddrinfo.3,v 1.60 2022/03/31 17:27:16 naddy Exp $ 1.\" $OpenBSD: getaddrinfo.3,v 1.61 2022/09/11 06:38:10 jmc Exp $
2.\" $KAME: getaddrinfo.3,v 1.36 2005/01/05 03:23:05 itojun Exp $ 2.\" $KAME: getaddrinfo.3,v 1.36 2005/01/05 03:23:05 itojun Exp $
3.\" 3.\"
4.\" Copyright (C) 2004 Internet Systems Consortium, Inc. ("ISC") 4.\" Copyright (C) 2004 Internet Systems Consortium, Inc. ("ISC")
@@ -16,7 +16,7 @@
16.\" OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR 16.\" OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
17.\" PERFORMANCE OF THIS SOFTWARE. 17.\" PERFORMANCE OF THIS SOFTWARE.
18.\" 18.\"
19.Dd $Mdocdate: March 31 2022 $ 19.Dd $Mdocdate: September 11 2022 $
20.Dt GETADDRINFO 3 20.Dt GETADDRINFO 3
21.Os 21.Os
22.Sh NAME 22.Sh NAME
@@ -68,7 +68,7 @@ must be non-null.
68.Pp 68.Pp
69.Fa hints 69.Fa hints
70is an optional pointer to a 70is an optional pointer to a
71.Li struct addrinfo , 71.Vt struct addrinfo ,
72as defined by 72as defined by
73.In netdb.h : 73.In netdb.h :
74.Bd -literal 74.Bd -literal
@@ -139,7 +139,7 @@ will return a NUL-terminated string containing the canonical name
139of the specified host name in the 139of the specified host name in the
140.Fa ai_canonname 140.Fa ai_canonname
141element of the first 141element of the first
142.Li addrinfo 142.Vt addrinfo
143structure returned. 143structure returned.
144.It Dv AI_FQDN 144.It Dv AI_FQDN
145If the 145If the
@@ -150,7 +150,7 @@ will return a NUL-terminated string containing the fully qualified domain name
150of the specified host name in the 150of the specified host name in the
151.Fa ai_canonname 151.Fa ai_canonname
152element of the first 152element of the first
153.Li addrinfo 153.Vt addrinfo
154structure returned. 154structure returned.
155.Pp 155.Pp
156This is different from the 156This is different from the
@@ -215,7 +215,7 @@ is not set.
215.El 215.El
216.Pp 216.Pp
217All other elements of the 217All other elements of the
218.Li addrinfo 218.Vt addrinfo
219structure passed via 219structure passed via
220.Fa hints 220.Fa hints
221must be zero or the null pointer. 221must be zero or the null pointer.
@@ -225,7 +225,7 @@ If
225is the null pointer, 225is the null pointer,
226.Fn getaddrinfo 226.Fn getaddrinfo
227behaves as if the caller provided a 227behaves as if the caller provided a
228.Li struct addrinfo 228.Vt struct addrinfo
229with 229with
230.Fa ai_family 230.Fa ai_family
231set to 231set to
@@ -240,12 +240,12 @@ After a successful call to
240.Fn getaddrinfo , 240.Fn getaddrinfo ,
241.Fa *res 241.Fa *res
242is a pointer to a linked list of one or more 242is a pointer to a linked list of one or more
243.Li addrinfo 243.Vt addrinfo
244structures. 244structures.
245The list can be traversed by following the 245The list can be traversed by following the
246.Fa ai_next 246.Fa ai_next
247pointer in each 247pointer in each
248.Li addrinfo 248.Vt addrinfo
249structure until a null pointer is encountered. 249structure until a null pointer is encountered.
250The three members 250The three members
251.Fa ai_family , 251.Fa ai_family ,
@@ -253,11 +253,11 @@ The three members
253and 253and
254.Fa ai_protocol 254.Fa ai_protocol
255in each returned 255in each returned
256.Li addrinfo 256.Vt addrinfo
257structure are suitable for a call to 257structure are suitable for a call to
258.Xr socket 2 . 258.Xr socket 2 .
259For each 259For each
260.Li addrinfo 260.Vt addrinfo
261structure in the list, the 261structure in the list, the
262.Fa ai_addr 262.Fa ai_addr
263member points to a filled-in socket address structure of length 263member points to a filled-in socket address structure of length
@@ -298,10 +298,10 @@ the interface and link, which is not necessarily true from the specification.
298All of the information returned by 298All of the information returned by
299.Fn getaddrinfo 299.Fn getaddrinfo
300is dynamically allocated: the 300is dynamically allocated: the
301.Li addrinfo 301.Vt addrinfo
302structures themselves as well as the socket address structures and 302structures themselves as well as the socket address structures and
303the canonical host name strings included in the 303the canonical host name strings included in the
304.Li addrinfo 304.Vt addrinfo
305structures. 305structures.
306.Pp 306.Pp
307Memory allocated for the dynamically allocated structures created by 307Memory allocated for the dynamically allocated structures created by
@@ -313,7 +313,7 @@ function.
313The 313The
314.Fa ai 314.Fa ai
315pointer should be an 315pointer should be an
316.Li addrinfo 316.Vt addrinfo
317structure created by a call to 317structure created by a call to
318.Fn getaddrinfo . 318.Fn getaddrinfo .
319.Sh RETURN VALUES 319.Sh RETURN VALUES
@@ -324,7 +324,7 @@ if an error occurs.
324If an error occurs, no memory is allocated by 324If an error occurs, no memory is allocated by
325.Fn getaddrinfo , 325.Fn getaddrinfo ,
326therefore it is not necessary to release the 326therefore it is not necessary to release the
327.Li addrinfo 327.Vt addrinfo
328structure(s). 328structure(s).
329.Sh EXAMPLES 329.Sh EXAMPLES
330The following code tries to connect to 330The following code tries to connect to