xref: /freebsd/lib/libc/net/gai_strerror.3 (revision 4f8f43b06ed07e96a250855488cc531799d5b78f)
1.\"	$KAME: gai_strerror.3,v 1.1 2005/01/05 03:04:47 itojun Exp $
2.\"	$OpenBSD: gai_strerror.3,v 1.4 2004/12/20 23:04:53 millert Exp $
3.\"
4.\" Copyright (C) 2004  Internet Systems Consortium, Inc. ("ISC")
5.\" Copyright (C) 2000, 2001  Internet Software Consortium.
6.\"
7.\" Permission to use, copy, modify, and distribute this software for any
8.\" purpose with or without fee is hereby granted, provided that the above
9.\" copyright notice and this permission notice appear in all copies.
10.\"
11.\" THE SOFTWARE IS PROVIDED "AS IS" AND ISC DISCLAIMS ALL WARRANTIES WITH
12.\" REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
13.\" AND FITNESS.  IN NO EVENT SHALL ISC BE LIABLE FOR ANY SPECIAL, DIRECT,
14.\" INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM
15.\" LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE
16.\" OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
17.\" PERFORMANCE OF THIS SOFTWARE.
18.\"
19.Dd November 2, 2022
20.Dt GAI_STRERROR 3
21.Os
22.Sh NAME
23.Nm gai_strerror
24.Nd get error message string from EAI_xxx error code
25.Sh SYNOPSIS
26.In sys/types.h
27.In sys/socket.h
28.In netdb.h
29.Ft "const char *"
30.Fn gai_strerror "int ecode"
31.Sh DESCRIPTION
32The
33.Fn gai_strerror
34function returns an error message string corresponding to the error code
35returned by
36.Xr getaddrinfo 3
37or
38.Xr getnameinfo 3 .
39.Pp
40The following error codes and their meaning are defined in
41.In netdb.h :
42.Pp
43.Bl -tag -width ".Dv EAI_ADDRFAMILY" -offset indent -compact
44.It Dv EAI_ADDRFAMILY
45Address family for hostname not supported
46.It Dv EAI_AGAIN
47Name could not be resolved at this time
48.It Dv EAI_BADFLAGS
49flags parameter had an invalid value
50.It Dv EAI_BADHINTS
51invalid value for
52.Fa hints
53.It Dv EAI_FAIL
54Non-recoverable failure in name resolution
55.It Dv EAI_FAMILY
56Address family was not recognized
57.It Dv EAI_MEMORY
58Memory allocation failure
59.It Dv EAI_NODATA
60No address associated with hostname
61.It Dv EAI_NONAME
62Name does not resolve
63.It Dv EAI_OVERFLOW
64argument buffer overflow
65.It Dv EAI_PROTOCOL
66Resolved protocol is unknown
67.It Dv EAI_SERVICE
68Service was not recognized for socket type
69.It Dv EAI_SOCKTYPE
70Intended socket type was not recognized
71.It Dv EAI_SYSTEM
72System error returned in
73.Va errno
74.El
75.Sh RETURN VALUES
76The
77.Fn gai_strerror
78function
79returns a pointer to the error message string corresponding to
80.Fa ecode .
81If
82.Fa ecode
83is out of range, an implementation-specific error message string is returned.
84.Sh SEE ALSO
85.Xr getaddrinfo 3 ,
86.Xr getnameinfo 3
87.Sh STANDARDS
88.Bl -tag -width ".It RFC 3493"
89.It RFC 3493
90Basic Socket Interface Extensions for IPv6
91.El
92.Pp
93EAI_ADDRFAMILY and EAI_NODATA were in previous RFCs, but not in RFC 3493.
94They are not in POSIX (IEEE Std 1003.1-2017).
95They were in
96.Fx
97before 5.2, and were re-added for 14.0.
98EAI_BADHINTS, EAI_OVERFLOW, and EAI_PROTOCOL are not in RFC 3493 or POSIX.
99