[ Next Article | Previous Article | Book Contents | Library Home | Legal | Search ]
Base Operating System and Extensions Technical Reference, Volume 1

gai_strerror Subroutine

Purpose

Facilitates consistent error information from EAI_* values returned by getaddrinfo.

Library

Library (libc.a)

Syntax

#include <sys/socket.h>
#include <netdb.h>
char *
gai_strerror (ecode)
int ecode;
int
gai_strerror_r (ecode, buf, buflen)
int ecode;
char *buf;
int buflen;

Description

Facilitates consistent error information from EAI_* values returned by getaddrinfo.

For multithreaded environments, the second version should be used. In gai_strerror_r, buf is a pointer to a data area to be filled in. buflen is the length (in bytes) available in buf.

It is the caller's responsibility to insure that buf is sufficiently large to store the requested information, including a trailing null character. It is the responsibility of the function to insure that no more than buflen bytes are written into buf.

Return Values

If successful, a pointer to a string containing an error message appropriate for the EAI_* errors is returned. If ecode is not one of the EAI_* values, a pointer to a string indicating an unknown error is returned.

Related Information

The getaddrinfo subroutine, freeaddrinfo subroutine, and getnameinfo subroutine.

Subroutines Overview in AIX Version 4 General Programming Concepts: Writing and Debugging Programs.


[ Next Article | Previous Article | Book Contents | Library Home | Legal | Search ]