[ Previous | Next | Table of Contents | Index | Library Home | Legal | Search ]

Technical Reference: Base Operating System and Extensions, Volume 1


gai_strerror Subroutine

Purpose

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

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 (getaddrinfo Subroutine).

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 (getaddrinfo Subroutine) subroutine, freeaddrinfo (freeaddrinfo Subroutine) subroutine, and getnameinfo (getnameinfo Subroutine) subroutine.

Subroutines Overview in AIX 5L Version 5.1 General Programming Concepts: Writing and Debugging Programs.


[ Previous | Next | Table of Contents | Index | Library Home | Legal | Search ]