gai_strerror()

Return the string associated with a getaddrinfo() error code

Synopsis:

#include <sys/types.h>
#include <sys/socket.h>
#include <netdb.h>

const char * gai_strerror( int ecode );

Arguments:

ecode
The error code number from the getaddrinfo() function.

Library:

libsocket

Use the -l socket option to qcc to link against this library.

Description:

The gai_strerror() function returns a string describing the error code from the getaddrinfo() function. Nonzero error codes are defined in <netdb.h> as follows:

EAI_ADDRFAMILY
The address family for nodename isn't supported.
EAI_AGAIN
There was a temporary failure in name resolution.
EAI_BADFLAGS
Invalid value for ai_flags.
EAI_FAIL
Nonrecoverable failure in name resolution.
EAI_FAMILY
The ai_family isn't supported.
EAI_MEMORY
Memory allocation failure.
EAI_NODATA
No address associated with the nodename.
EAI_NONAME
Either the nodename or the servname argument wasn't provided or isn't known.
EAI_SERVICE
The servname argument isn't supported for ai_socktype.
EAI_SOCKTYPE
The ai_socktype isn't supported.
EAI_SYSTEM
System error returned in errno.

Returns:

If called with a proper ecode argument, a pointer to a string describing the given error code. If the argument isn't one of the EAI_* values, a pointer to a string whose contents indicate an unknown error.


Note: Don't modify the strings that this function returns.

Classification:

POSIX 1003.1

Safety:
Cancellation point No
Interrupt handler Yes
Signal handler Yes
Thread Yes

See also:

addrinfo, freeaddrinfo(), getaddrinfo()