]> git.saurik.com Git - apple/libinfo.git/blobdiff - lookup.subproj/getaddrinfo.3
Libinfo-278.tar.gz
[apple/libinfo.git] / lookup.subproj / getaddrinfo.3
index 5ab76fb08ceab6ea8e1306ede9b751392634a906..b03fa0cda00bea5c4845ead67956a8f9253d08dc 100644 (file)
 .Dt GETADDRINFO 3
 .Os
 .Sh NAME
-.Nm getaddrinfo ,
-.Nm freeaddrinfo
+.Nm freeaddrinfo ,
+.Nm getaddrinfo
 .Nd socket address structure to host and service name
 .Sh SYNOPSIS
-.Fd #include <sys/types.h>
 .Fd #include <sys/socket.h>
 .Fd #include <netdb.h>
-.Ft int
-.Fn getaddrinfo "const char *hostname" "const char *servname" \
-    "const struct addrinfo *hints" "struct addrinfo **res"
 .Ft void
-.Fn freeaddrinfo "struct addrinfo *ai"
+.Fo freeaddrinfo
+.Fa "struct addrinfo *ai"
+.Fc
+.Ft int
+.Fo getaddrinfo
+.Fa "const char *restrict nodename"
+.Fa "const char *restrict servname"
+.Fa "const struct addrinfo *restrict hints"
+.Fa "struct addrinfo **restrict res"
+.Fc
 .Sh DESCRIPTION
 The
 .Fn getaddrinfo
 function is used to get a list of
 .Tn IP
 addresses and port numbers for host
-.Fa hostname
+.Fa nodename
 and service
 .Fa servname .
 It is a replacement for and provides more flexibility than the
@@ -49,12 +54,12 @@ and
 functions.
 .Pp
 The
-.Fa hostname
+.Fa nodename
 and
 .Fa servname
 arguments are either pointers to NUL-terminated strings or the null pointer.
 An acceptable value for
-.Fa hostname
+.Fa nodename
 is either a valid host name or a numeric host address string consisting
 of a dotted decimal IPv4 address or an IPv6 address.
 The
@@ -62,7 +67,7 @@ The
 is either a decimal port number or a service name listed in
 .Xr services 5 .
 At least one of
-.Fa hostname
+.Fa nodename
 and
 .Fa servname
 must be non-null.
@@ -136,7 +141,7 @@ structure returned.
 If the
 .Dv AI_NUMERICHOST
 bit is set, it indicates that
-.Fa hostname
+.Fa nodename
 should be treated as a numeric string defining an IPv4 or IPv6 address
 and no name resolution should be attempted.
 .It Dv AI_PASSIVE
@@ -146,7 +151,7 @@ bit is set it indicates that the returned socket address structure
 is intended for use in a call to
 .Xr bind 2 .
 In this case, if the
-.Fa hostname
+.Fa nodename
 argument is the null pointer, then the IP address portion of the
 socket address structure will be set to
 .Dv INADDR_ANY
@@ -169,7 +174,7 @@ The
 .Tn IP
 address portion of the socket address structure will be set to the
 loopback address if
-.Fa hostname
+.Fa nodename
 is the null pointer and
 .Dv AI_PASSIVE
 is not set.
@@ -379,6 +384,14 @@ if (nsock == 0) {
 }
 freeaddrinfo(res0);
 .Ed
+.Sh LEGACY SYNOPSIS
+.Fd #include <sys/types.h>
+.Fd #include <sys/socket.h>
+.Fd #include <netdb.h>
+.Pp
+The include file
+.In sys/types.h
+is necessary.
 .Sh SEE ALSO
 .Xr bind 2 ,
 .Xr connect 2 ,
@@ -429,7 +442,3 @@ function is defined by the
 draft specification and documented in
 .Dv "RFC 3493" ,
 .Dq Basic Socket Interface Extensions for IPv6 .
-.Sh BUGS
-The implementation of
-.Fn getaddrinfo
-is not thread-safe.