+.\" %%%LICENSE_START(PUBLIC_DOMAIN)
.\" This page is in the public domain.
+.\" %%%LICENSE_END
+.\"
.\" Almost all details are from RFC 2553.
.\"
.\" 2004-12-14, mtk, Added EAI_OVERFLOW error
.\" 2004-12-14 Fixed description of error return
.\"
-.TH GETNAMEINFO 3 2009-12-03 "GNU" "Linux Programmer's Manual"
+.TH GETNAMEINFO 3 2014-05-28 "GNU" "Linux Programmer's Manual"
.SH NAME
getnameinfo \- address-to-name translation in protocol-independent manner
.SH SYNOPSIS
.B #include <netdb.h>
.sp
.BI "int getnameinfo(const struct sockaddr *" "sa" ", socklen_t " "salen" ,
-.BI " char *" "host" ", size_t " "hostlen" ,
-.BI " char *" "serv" ", size_t " "servlen" ", int " "flags" );
+.BI " char *" "host" ", socklen_t " "hostlen" ,
+.BI " char *" "serv" ", socklen_t " "servlen" ", int " "flags" );
.fi
.sp
.in -4n
and
.BR getservbyport (3),
but unlike those functions,
-.BR getaddrinfo (3)
+.BR getnameinfo ()
is reentrant and allows programs to eliminate
IPv4-versus-IPv6 dependencies.
If set, then the numeric form of the service address is returned.
(When not set, this will still happen in case the service's name
cannot be determined.)
-.SS "Extensions to getaddrinfo() for Internationalized Domain Names"
+.SS Extensions to getnameinfo() for Internationalized Domain Names
.PP
Starting with glibc 2.3.4,
.BR getnameinfo ()
IDNA_USE_STD3_ASCII_RULES (check output to make sure it is a STD3
conforming hostname)
flags respectively to be used in the IDNA handling.
-.SH "RETURN VALUE"
+.SH RETURN VALUE
.\" FIXME glibc defines the following additional errors, some which
.\" can probably be returned by getnameinfo(); they need to
.\" be documented.
On success 0 is returned, and node and service names, if requested,
are filled with null-terminated strings, possibly truncated to fit
the specified buffer lengths.
-On error one of the following nonzero error codes is returned:
+On error, one of the following nonzero error codes is returned:
.TP
.B EAI_AGAIN
The name could not be resolved at this time.
.SH VERSIONS
.BR getnameinfo ()
is provided in glibc since version 2.1.
-.SH "CONFORMING TO"
+.SH CONFORMING TO
RFC\ 2553, POSIX.1-2001.
.SH NOTES
In order to assist the programmer in choosing reasonable sizes
header file.
The latter is a guess based on the services listed
in the current Assigned Numbers RFC.
+
+Before glibc version 2.2, the
+.I hostlen
+and
+.I servlen
+arguments were typed as
+.IR size_t .
.SH EXAMPLE
The following code tries to get the numeric hostname and service name,
for a given socket address.
.BR getnameinfo ()
can be found in
.BR getaddrinfo (3).
-.SH "SEE ALSO"
+.SH SEE ALSO
.BR accept (2),
.BR getpeername (2),
.BR getsockname (2),
.BR services (5),
.BR hostname (7),
.BR named (8)
-.LP
+
R. Gilligan, S. Thomson, J. Bound and W. Stevens,
.IR "Basic Socket Interface Extensions for IPv6" ,
RFC\ 2553, March 1999.
-.LP
+
Tatsuya Jinmei and Atsushi Onoe,
.IR "An Extension of Format for IPv6 Scoped Addresses" ,
-internet draft, work in progress.
-ftp://ftp.ietf.org/internet\-drafts/draft\-ietf\-ipngwg\-scopedaddr\-format\-02.txt
-.LP
+internet draft, work in progress
+.UR ftp://ftp.ietf.org\:/internet\-drafts\:/draft\-ietf\-ipngwg\-scopedaddr\-format\-02.txt
+.UE .
+
Craig Metz,
.IR "Protocol Independence Using the Sockets API" ,
Proceedings of the freenix track:
-2000 USENIX annual technical conference, June 2000.
+2000 USENIX annual technical conference, June 2000
.ad l
-http://www.usenix.org/publications/library/proceedings/usenix2000/freenix/metzprotocol.html
+.UR http://www.usenix.org\:/publications\:/library\:/proceedings\:/usenix2000\:/freenix\:/metzprotocol.html
+.UE .
+.SH COLOPHON
+This page is part of release 3.79 of the Linux
+.I man-pages
+project.
+A description of the project,
+information about reporting bugs,
+and the latest version of this page,
+can be found at
+\%http://www.kernel.org/doc/man\-pages/.