Open System Services System Calls Reference Manual (G06.28+)
gethostbyaddr_r(2) OSS System Calls Reference Manual
NAME
gethostbyaddr_r - Gets a network host entry by address (AF_INET only) (reentrant)
LIBRARY
G-series native OSS processes: /G/system/sysnn/zsptsrl
H-series OSS processes: /G/system/zdllnnn/zsptdll
SYNOPSIS
[#include <sys/socket.h>]
[#include <netdb.h>]
#include <spthread.h>
[extern h_errno;]
struct hostent *gethostbyaddr_r (
const char *addr,
int length,
int type,
struct hostent *host,
char *buffer,
int buflen,
int *h_errnop
);
PARAMETERS
addr Specifies an Internet address in network-byte order.
length On input, specifies the number of bytes in addr. On output, specifies the number
of bytes in the retrieved address.
type Specifies the Internet domain address format. The value AF_INET must be
used.
host Points to a struct hostent structure allocated by the caller.
buffer Points to the buffer supplied by the caller and used as a storage space for host
data.
buflen Specifies the size of the buffer passed in bytes.
h_errnop Points to the global integer h_errno to indicate the error code if an error occurs.
See the ERRORS subsection of this reference page for the possible values that
can be returned.
DESCRIPTION
The gethostbyaddr_r() function is the reentrant version of the gethostbyaddr() function.
The gethostbyaddr_r() function searches host entries until a match with the addr and type
parameters is found. This function returns a pointer to a hostent struct whose members specify
data from a name server specified in the /etc/resolv.conf file or the /etc/hosts network hostname
database file. gethostbyaddr_r() first attempts to search /etc/resolv.conf, but when the name
server is not running, the gethostbyaddr_r() function searches the hosts name file.
The gethostbyaddr_r() function updates the hostent structure pointed to by the host parameter.
Storage referenced by the hostent structure is allocated from the memory provided with the
buffer parameter, which is buflen characters in size. The h_errnop parameter is updated with the
value of the h_errno variable to indicate any errors.
The hostent structure is defined in the netdb.h header file.
3−54 Hewlett-Packard Company 527186-005