2004-11-03 13:51:07 +00:00
|
|
|
.\" Copyright 1993 David Metcalfe (david@prism.demon.co.uk)
|
|
|
|
.\"
|
|
|
|
.\" Permission is granted to make and distribute verbatim copies of this
|
|
|
|
.\" manual provided the copyright notice and this permission notice are
|
|
|
|
.\" preserved on all copies.
|
|
|
|
.\"
|
|
|
|
.\" Permission is granted to copy and distribute modified versions of this
|
|
|
|
.\" manual under the conditions for verbatim copying, provided that the
|
|
|
|
.\" entire resulting derived work is distributed under the terms of a
|
|
|
|
.\" permission notice identical to this one.
|
2007-04-12 22:42:49 +00:00
|
|
|
.\"
|
2004-11-03 13:51:07 +00:00
|
|
|
.\" Since the Linux kernel and libraries are constantly changing, this
|
|
|
|
.\" manual page may be incorrect or out-of-date. The author(s) assume no
|
|
|
|
.\" responsibility for errors or omissions, or for damages resulting from
|
|
|
|
.\" the use of the information contained herein. The author(s) may not
|
|
|
|
.\" have taken the same level of care in the production of this manual,
|
|
|
|
.\" which is licensed free of charge, as they might when working
|
|
|
|
.\" professionally.
|
2007-04-12 22:42:49 +00:00
|
|
|
.\"
|
2004-11-03 13:51:07 +00:00
|
|
|
.\" Formatted or processed versions of this manual, if unaccompanied by
|
|
|
|
.\" the source, must acknowledge the copyright and authors of this work.
|
|
|
|
.\"
|
|
|
|
.\" References consulted:
|
|
|
|
.\" Linux libc source code
|
|
|
|
.\" Lewine's _POSIX Programmer's Guide_ (O'Reilly & Associates, 1991)
|
|
|
|
.\" 386BSD man pages
|
|
|
|
.\" Modified 1993-05-22, David Metcalfe
|
|
|
|
.\" Modified 1993-07-25, Rik Faith (faith@cs.unc.edu)
|
|
|
|
.\" Modified 1997-02-16, Andries Brouwer (aeb@cwi.nl)
|
|
|
|
.\" Modified 1998-12-21, Andries Brouwer (aeb@cwi.nl)
|
|
|
|
.\" Modified 2000-08-12, Andries Brouwer (aeb@cwi.nl)
|
|
|
|
.\" Modified 2001-05-19, Andries Brouwer (aeb@cwi.nl)
|
|
|
|
.\" Modified 2002-08-05, Michael Kerrisk
|
|
|
|
.\" Modified 2004-10-31, Andries Brouwer
|
|
|
|
.\"
|
2009-12-03 12:24:13 +00:00
|
|
|
.TH GETHOSTBYNAME 3 2009-12-03 "" "Linux Programmer's Manual"
|
2004-11-03 13:51:07 +00:00
|
|
|
.SH NAME
|
2005-10-19 13:20:29 +00:00
|
|
|
gethostbyname, gethostbyaddr, sethostent, gethostent, endhostent,
|
2008-03-17 10:14:15 +00:00
|
|
|
h_errno,
|
2007-07-08 14:31:36 +00:00
|
|
|
herror, hstrerror,
|
2007-11-24 10:30:42 +00:00
|
|
|
gethostbyaddr_r,
|
2007-07-08 14:31:36 +00:00
|
|
|
gethostbyname2, gethostbyname2_r, gethostbyname_r,
|
|
|
|
gethostent_r \- get network host entry
|
2004-11-03 13:51:07 +00:00
|
|
|
.SH SYNOPSIS
|
|
|
|
.nf
|
|
|
|
.B #include <netdb.h>
|
|
|
|
.B extern int h_errno;
|
|
|
|
.sp
|
|
|
|
.BI "struct hostent *gethostbyname(const char *" name );
|
|
|
|
.sp
|
|
|
|
.BR "#include <sys/socket.h>" " /* for AF_INET */"
|
2007-12-11 16:57:30 +00:00
|
|
|
.BI "struct hostent *gethostbyaddr(const void *" addr ,
|
2007-12-07 19:55:54 +00:00
|
|
|
.BI " socklen_t " len ", int " type );
|
2004-11-03 13:51:07 +00:00
|
|
|
.sp
|
|
|
|
.BI "void sethostent(int " stayopen );
|
|
|
|
.sp
|
|
|
|
.B void endhostent(void);
|
|
|
|
.sp
|
|
|
|
.BI "void herror(const char *" s );
|
|
|
|
.sp
|
|
|
|
.BI "const char *hstrerror(int " err );
|
2007-04-03 15:32:52 +00:00
|
|
|
.sp
|
2006-01-13 09:44:53 +00:00
|
|
|
/* System V/POSIX extension */
|
2004-11-03 13:51:07 +00:00
|
|
|
.br
|
|
|
|
.B struct hostent *gethostent(void);
|
2007-04-03 15:32:52 +00:00
|
|
|
.sp
|
2004-11-03 13:51:07 +00:00
|
|
|
/* GNU extensions */
|
|
|
|
.br
|
|
|
|
.BI "struct hostent *gethostbyname2(const char *" name ", int " af );
|
|
|
|
.sp
|
2007-09-20 16:26:31 +00:00
|
|
|
.B "int gethostent_r("
|
2007-04-03 15:32:52 +00:00
|
|
|
.BI " struct hostent *" ret ", char *" buf ", size_t " buflen ,
|
|
|
|
.BI " struct hostent **" result ", int *" h_errnop );
|
2004-11-03 13:51:07 +00:00
|
|
|
.sp
|
2007-08-27 12:24:27 +00:00
|
|
|
.BI "int gethostbyaddr_r(const void *" addr ", socklen_t " len ", int " type ,
|
|
|
|
.BI " struct hostent *" ret ", char *" buf ", size_t " buflen ,
|
|
|
|
.BI " struct hostent **" result ", int *" h_errnop );
|
|
|
|
.sp
|
2004-11-03 13:51:07 +00:00
|
|
|
.BI "int gethostbyname_r(const char *" name ,
|
2007-04-03 15:32:52 +00:00
|
|
|
.BI " struct hostent *" ret ", char *" buf ", size_t " buflen ,
|
|
|
|
.BI " struct hostent **" result ", int *" h_errnop );
|
2004-11-03 13:51:07 +00:00
|
|
|
.sp
|
|
|
|
.BI "int gethostbyname2_r(const char *" name ", int " af,
|
2007-04-03 15:32:52 +00:00
|
|
|
.BI " struct hostent *" ret ", char *" buf ", size_t " buflen ,
|
|
|
|
.BI " struct hostent **" result ", int *" h_errnop );
|
2004-11-03 13:51:07 +00:00
|
|
|
.fi
|
2007-07-08 12:11:40 +00:00
|
|
|
.sp
|
|
|
|
.in -4n
|
|
|
|
Feature Test Macro Requirements for glibc (see
|
|
|
|
.BR feature_test_macros (7)):
|
|
|
|
.in
|
|
|
|
.sp
|
|
|
|
.ad l
|
|
|
|
.BR gethostbyname2 (),
|
|
|
|
.BR gethostent_r (),
|
2007-08-27 12:24:27 +00:00
|
|
|
.BR gethostbyaddr_r (),
|
2007-07-08 12:11:40 +00:00
|
|
|
.BR gethostbyname_r (),
|
|
|
|
.BR gethostbyname2_r ():
|
2010-09-19 05:12:20 +00:00
|
|
|
.RS 4
|
2007-07-08 12:11:40 +00:00
|
|
|
_BSD_SOURCE || _SVID_SOURCE
|
2010-09-19 05:12:20 +00:00
|
|
|
.RE
|
2009-12-03 12:24:13 +00:00
|
|
|
|
|
|
|
.BR herror (),
|
|
|
|
.BR hstrerror ()
|
2010-09-19 05:12:20 +00:00
|
|
|
.RS 4
|
2009-12-03 12:24:13 +00:00
|
|
|
(since glibc 2.8): _BSD_SOURCE || _SVID_SOURCE || _GNU_SOURCE
|
2010-09-19 05:12:20 +00:00
|
|
|
.RE
|
2007-07-08 12:11:40 +00:00
|
|
|
.ad b
|
2004-11-03 13:51:07 +00:00
|
|
|
.SH DESCRIPTION
|
2008-08-18 09:14:44 +00:00
|
|
|
The
|
|
|
|
.BR gethostbyname* ()
|
|
|
|
and
|
|
|
|
.BR gethostbyaddr* ()
|
|
|
|
functions are obsolete.
|
2007-10-14 18:29:55 +00:00
|
|
|
Applications should use
|
|
|
|
.BR getaddrinfo (3)
|
|
|
|
and
|
|
|
|
.BR getnameinfo (3)
|
|
|
|
instead.
|
|
|
|
|
2004-11-03 13:51:07 +00:00
|
|
|
The
|
|
|
|
.BR gethostbyname ()
|
|
|
|
function returns a structure of type
|
|
|
|
.I hostent
|
|
|
|
for the given host
|
|
|
|
.IR name .
|
|
|
|
Here
|
|
|
|
.I name
|
2008-06-27 03:37:56 +00:00
|
|
|
is either a hostname, or an IPv4 address in standard dot notation (as for
|
2008-06-13 10:14:55 +00:00
|
|
|
.BR inet_addr (3)),
|
2004-11-03 13:51:07 +00:00
|
|
|
or an IPv6 address in colon (and possibly dot) notation.
|
2005-07-20 07:50:45 +00:00
|
|
|
(See RFC\ 1884 for the description of IPv6 addresses.)
|
2004-11-03 13:51:07 +00:00
|
|
|
If
|
|
|
|
.I name
|
|
|
|
is an IPv4 or IPv6 address, no lookup is performed and
|
|
|
|
.BR gethostbyname ()
|
|
|
|
simply copies
|
|
|
|
.I name
|
|
|
|
into the
|
|
|
|
.I h_name
|
|
|
|
field and its
|
|
|
|
.I struct in_addr
|
|
|
|
equivalent into the
|
|
|
|
.I h_addr_list[0]
|
|
|
|
field of the returned
|
|
|
|
.I hostent
|
|
|
|
structure.
|
|
|
|
If
|
|
|
|
.I name
|
|
|
|
doesn't end in a dot and the environment variable
|
|
|
|
.B HOSTALIASES
|
|
|
|
is set, the alias file pointed to by
|
|
|
|
.B HOSTALIASES
|
|
|
|
will first be searched for
|
|
|
|
.I name
|
|
|
|
(see
|
|
|
|
.BR hostname (7)
|
|
|
|
for the file format).
|
|
|
|
The current domain and its parents are searched unless \fIname\fP
|
|
|
|
ends in a dot.
|
|
|
|
.PP
|
2007-05-12 09:06:04 +00:00
|
|
|
The
|
|
|
|
.BR gethostbyaddr ()
|
|
|
|
function returns a structure of type \fIhostent\fP
|
2004-11-03 13:51:07 +00:00
|
|
|
for the given host address \fIaddr\fP of length \fIlen\fP and address type
|
2007-04-12 22:42:49 +00:00
|
|
|
\fItype\fP.
|
|
|
|
Valid address types are
|
2004-11-03 13:51:07 +00:00
|
|
|
.B AF_INET
|
|
|
|
and
|
|
|
|
.BR AF_INET6 .
|
|
|
|
The host address argument is a pointer to a struct of a type depending
|
2007-06-20 20:48:54 +00:00
|
|
|
on the address type, for example a \fIstruct in_addr *\fP (probably
|
2007-06-21 22:55:04 +00:00
|
|
|
obtained via a call to
|
2007-05-12 13:12:02 +00:00
|
|
|
.BR inet_addr (3))
|
2007-06-22 19:42:52 +00:00
|
|
|
for address type
|
|
|
|
.BR AF_INET .
|
2004-11-03 13:51:07 +00:00
|
|
|
.PP
|
2007-05-12 09:06:04 +00:00
|
|
|
The
|
|
|
|
.BR sethostent ()
|
|
|
|
function specifies, if \fIstayopen\fP is true (1),
|
2007-04-12 22:42:49 +00:00
|
|
|
that a connected TCP socket should be used for the name server queries and
|
|
|
|
that the connection should remain open during successive queries.
|
|
|
|
Otherwise, name server queries will use UDP datagrams.
|
2004-11-03 13:51:07 +00:00
|
|
|
.PP
|
2007-05-12 09:06:04 +00:00
|
|
|
The
|
|
|
|
.BR endhostent ()
|
|
|
|
function ends the use of a TCP connection for name
|
2004-11-03 13:51:07 +00:00
|
|
|
server queries.
|
|
|
|
.PP
|
2007-05-12 09:06:04 +00:00
|
|
|
The (obsolete)
|
|
|
|
.BR herror ()
|
|
|
|
function prints the error message associated
|
2007-07-28 06:36:12 +00:00
|
|
|
with the current value of \fIh_errno\fP on \fIstderr\fP.
|
2004-11-03 13:51:07 +00:00
|
|
|
.PP
|
2007-05-12 09:06:04 +00:00
|
|
|
The (obsolete)
|
|
|
|
.BR hstrerror ()
|
|
|
|
function takes an error number
|
2004-11-03 13:51:07 +00:00
|
|
|
(typically \fIh_errno\fP) and returns the corresponding message string.
|
|
|
|
.PP
|
2007-05-12 09:06:04 +00:00
|
|
|
The domain name queries carried out by
|
|
|
|
.BR gethostbyname ()
|
|
|
|
and
|
|
|
|
.BR gethostbyaddr ()
|
|
|
|
use a combination of any or all of the name server
|
2004-11-03 13:51:07 +00:00
|
|
|
.BR named (8),
|
|
|
|
a broken out line from \fI/etc/hosts\fP, and the Network
|
|
|
|
Information Service (NIS or YP), depending upon the contents of the
|
|
|
|
\fIorder\fP line in
|
|
|
|
.IR /etc/host.conf .
|
2005-12-13 15:22:17 +00:00
|
|
|
.\" (See
|
|
|
|
.\" .BR resolv+ (8)).
|
2004-11-03 13:51:07 +00:00
|
|
|
The default action is to query
|
|
|
|
.BR named (8),
|
|
|
|
followed by
|
|
|
|
.IR /etc/hosts .
|
|
|
|
.PP
|
|
|
|
The \fIhostent\fP structure is defined in \fI<netdb.h>\fP as follows:
|
|
|
|
.sp
|
2007-12-19 05:53:30 +00:00
|
|
|
.in +4n
|
2004-11-03 13:51:07 +00:00
|
|
|
.nf
|
|
|
|
.ne 7
|
|
|
|
struct hostent {
|
2007-04-03 15:32:52 +00:00
|
|
|
char *h_name; /* official name of host */
|
|
|
|
char **h_aliases; /* alias list */
|
|
|
|
int h_addrtype; /* host address type */
|
|
|
|
int h_length; /* length of address */
|
|
|
|
char **h_addr_list; /* list of addresses */
|
2004-11-03 13:51:07 +00:00
|
|
|
}
|
2007-04-03 15:32:52 +00:00
|
|
|
#define h_addr h_addr_list[0] /* for backward compatibility */
|
2004-11-03 13:51:07 +00:00
|
|
|
.fi
|
2007-12-19 05:53:30 +00:00
|
|
|
.in
|
2004-11-03 13:51:07 +00:00
|
|
|
.PP
|
|
|
|
The members of the \fIhostent\fP structure are:
|
|
|
|
.TP
|
|
|
|
.I h_name
|
|
|
|
The official name of the host.
|
|
|
|
.TP
|
|
|
|
.I h_aliases
|
2006-01-13 02:09:44 +00:00
|
|
|
An array of alternative names for the host, terminated by a NULL pointer.
|
2004-11-03 13:51:07 +00:00
|
|
|
.TP
|
|
|
|
.I h_addrtype
|
|
|
|
The type of address; always
|
|
|
|
.B AF_INET
|
|
|
|
or
|
|
|
|
.B AF_INET6
|
|
|
|
at present.
|
|
|
|
.TP
|
|
|
|
.I h_length
|
|
|
|
The length of the address in bytes.
|
|
|
|
.TP
|
|
|
|
.I h_addr_list
|
2006-01-13 02:09:44 +00:00
|
|
|
An array of pointers to network addresses for the host (in network byte
|
|
|
|
order), terminated by a NULL pointer.
|
2004-11-03 13:51:07 +00:00
|
|
|
.TP
|
|
|
|
.I h_addr
|
|
|
|
The first address in \fIh_addr_list\fP for backward compatibility.
|
|
|
|
.SH "RETURN VALUE"
|
|
|
|
The
|
|
|
|
.BR gethostbyname ()
|
|
|
|
and
|
2005-10-19 07:07:02 +00:00
|
|
|
.BR gethostbyaddr ()
|
2004-11-03 13:51:07 +00:00
|
|
|
functions return the
|
|
|
|
.I hostent
|
2007-04-12 22:42:49 +00:00
|
|
|
structure or a NULL pointer if an error occurs.
|
|
|
|
On error, the
|
2004-11-03 13:51:07 +00:00
|
|
|
.I h_errno
|
|
|
|
variable holds an error number.
|
|
|
|
When non-NULL, the return value may point at static data, see the notes below.
|
|
|
|
.SH ERRORS
|
|
|
|
The variable \fIh_errno\fP can have the following values:
|
|
|
|
.TP
|
|
|
|
.B HOST_NOT_FOUND
|
|
|
|
The specified host is unknown.
|
|
|
|
.TP
|
|
|
|
.BR NO_ADDRESS " or " NO_DATA
|
|
|
|
The requested name is valid but does not have an IP address.
|
|
|
|
.TP
|
|
|
|
.B NO_RECOVERY
|
2010-01-16 17:01:12 +00:00
|
|
|
A nonrecoverable name server error occurred.
|
2004-11-03 13:51:07 +00:00
|
|
|
.TP
|
|
|
|
.B TRY_AGAIN
|
2007-04-12 22:42:49 +00:00
|
|
|
A temporary error occurred on an authoritative name server.
|
|
|
|
Try again later.
|
2004-11-03 13:51:07 +00:00
|
|
|
.SH FILES
|
|
|
|
.TP
|
|
|
|
.I /etc/host.conf
|
|
|
|
resolver configuration file
|
|
|
|
.TP
|
|
|
|
.I /etc/hosts
|
|
|
|
host database file
|
2005-12-13 15:22:17 +00:00
|
|
|
.TP
|
|
|
|
.I /etc/nsswitch.conf
|
|
|
|
name service switch configuration
|
2004-11-03 13:51:07 +00:00
|
|
|
.SH "CONFORMING TO"
|
2008-03-19 15:09:59 +00:00
|
|
|
POSIX.1-2001 specifies
|
|
|
|
.BR gethostbyname (),
|
|
|
|
.BR gethostbyaddr (),
|
|
|
|
.BR sethostent (),
|
|
|
|
.BR endhostent (),
|
|
|
|
.BR gethostent (),
|
|
|
|
and
|
2008-10-22 10:00:05 +00:00
|
|
|
.IR h_errno ;
|
|
|
|
.BR gethostbyname (),
|
|
|
|
.BR gethostbyaddr (),
|
|
|
|
and
|
|
|
|
.IR h_errno
|
|
|
|
are marked obsolescent in that standard.
|
2008-08-06 12:18:31 +00:00
|
|
|
POSIX.1-2008 removes the specifications of
|
|
|
|
.BR gethostbyname (),
|
|
|
|
.BR gethostbyaddr (),
|
|
|
|
and
|
2009-03-14 18:35:17 +00:00
|
|
|
.IR h_errno ,
|
|
|
|
recommending the use of
|
|
|
|
.BR getaddrinfo (3)
|
|
|
|
and
|
|
|
|
.BR getnameinfo (3)
|
|
|
|
instead.
|
2007-05-16 17:35:34 +00:00
|
|
|
.SH NOTES
|
|
|
|
The functions
|
|
|
|
.BR gethostbyname ()
|
|
|
|
and
|
|
|
|
.BR gethostbyaddr ()
|
|
|
|
may return pointers to static data, which may be overwritten by
|
|
|
|
later calls.
|
|
|
|
Copying the
|
|
|
|
.I struct hostent
|
|
|
|
does not suffice, since it contains pointers; a deep copy is required.
|
|
|
|
.LP
|
2007-06-21 22:55:04 +00:00
|
|
|
In the original BSD implementation the
|
2007-05-26 05:56:21 +00:00
|
|
|
.I len
|
|
|
|
argument
|
2007-06-21 22:55:04 +00:00
|
|
|
of
|
2007-05-26 05:56:21 +00:00
|
|
|
.BR gethostbyname ()
|
|
|
|
was an
|
|
|
|
.IR int .
|
|
|
|
The SUSv2 standard is buggy and declares the
|
2007-05-16 17:35:34 +00:00
|
|
|
.I len
|
2008-07-10 20:53:08 +00:00
|
|
|
argument of
|
2007-05-16 17:35:34 +00:00
|
|
|
.BR gethostbyaddr ()
|
|
|
|
to be of type
|
|
|
|
.IR size_t .
|
|
|
|
(That is wrong, because it has to be
|
|
|
|
.IR int ,
|
|
|
|
and
|
|
|
|
.I size_t
|
|
|
|
is not.
|
|
|
|
POSIX.1-2001 makes it
|
|
|
|
.IR socklen_t ,
|
|
|
|
which is OK.)
|
2007-05-26 05:56:21 +00:00
|
|
|
See also
|
|
|
|
.BR accept (2).
|
2007-05-16 17:35:34 +00:00
|
|
|
.LP
|
|
|
|
The BSD prototype for
|
|
|
|
.BR gethostbyaddr ()
|
|
|
|
uses
|
|
|
|
.I const char *
|
|
|
|
for the first argument.
|
|
|
|
.SS "System V/POSIX Extension"
|
2004-11-03 13:51:07 +00:00
|
|
|
POSIX requires the
|
|
|
|
.BR gethostent ()
|
|
|
|
call, that should return the next entry in the host data base.
|
|
|
|
When using DNS/BIND this does not make much sense, but it may
|
|
|
|
be reasonable if the host data base is a file that can be read
|
2007-04-12 22:42:49 +00:00
|
|
|
line by line.
|
|
|
|
On many systems a routine of this name reads
|
2004-11-03 13:51:07 +00:00
|
|
|
from the file
|
|
|
|
.IR /etc/hosts .
|
2007-06-08 11:56:22 +00:00
|
|
|
.\" e.g., Linux, FreeBSD, Unixware, HP-UX
|
2004-11-03 13:51:07 +00:00
|
|
|
It may be available only when the library was built without DNS support.
|
2007-06-08 11:56:22 +00:00
|
|
|
.\" e.g., FreeBSD, AIX
|
2007-04-12 22:42:49 +00:00
|
|
|
The glibc version will ignore ipv6 entries.
|
|
|
|
This function is not reentrant,
|
2004-11-03 13:51:07 +00:00
|
|
|
and glibc adds a reentrant version
|
|
|
|
.BR gethostent_r ().
|
2007-05-16 17:35:34 +00:00
|
|
|
.SS "GNU Extensions"
|
2004-11-03 13:51:07 +00:00
|
|
|
Glibc2 also has a
|
2005-10-19 07:07:02 +00:00
|
|
|
.BR gethostbyname2 ()
|
2004-11-03 13:51:07 +00:00
|
|
|
that works like
|
2005-10-19 07:07:02 +00:00
|
|
|
.BR gethostbyname (),
|
2004-11-03 13:51:07 +00:00
|
|
|
but permits to specify the address family to which the address must belong.
|
|
|
|
.LP
|
|
|
|
Glibc2 also has reentrant versions
|
2007-08-27 12:24:27 +00:00
|
|
|
.BR gethostent_r (),
|
|
|
|
.BR gethostbyaddr_r (),
|
2005-10-19 07:07:02 +00:00
|
|
|
.BR gethostbyname_r ()
|
2004-11-03 13:51:07 +00:00
|
|
|
and
|
2005-10-19 07:07:02 +00:00
|
|
|
.BR gethostbyname2_r ().
|
2007-09-10 04:17:16 +00:00
|
|
|
The caller supplies a
|
|
|
|
.I hostent
|
|
|
|
structure
|
2007-08-27 12:24:27 +00:00
|
|
|
.I ret
|
2007-09-10 04:17:16 +00:00
|
|
|
which will be filled in on success, and a temporary work buffer
|
2004-11-03 13:51:07 +00:00
|
|
|
.I buf
|
2007-08-27 12:24:27 +00:00
|
|
|
of size
|
2004-11-03 13:51:07 +00:00
|
|
|
.IR buflen .
|
2007-08-27 12:24:27 +00:00
|
|
|
After the call,
|
|
|
|
.I result
|
2008-06-12 06:09:19 +00:00
|
|
|
will point to the result on success.
|
|
|
|
In case of an error
|
2007-08-27 12:24:27 +00:00
|
|
|
or if no entry is found
|
|
|
|
.I result
|
2007-09-10 04:17:16 +00:00
|
|
|
will be NULL.
|
intro.1, time.1, adjtimex.2, capget.2, eventfd.2, fcntl.2, getrlimit.2, getsockopt.2, gettimeofday.2, intro.2, ioctl_list.2, ioperm.2, mlock.2, pivot_root.2, poll.2, prctl.2, ptrace.2, sched_setscheduler.2, select_tut.2, semget.2, sigaltstack.2, signalfd.2, sysctl.2, timer_settime.2, timerfd_create.2, wait.2, CPU_SET.3, argz_add.3, assert_perror.3, atexit.3, backtrace.3, bcmp.3, clearenv.3, ctime.3, dl_iterate_phdr.3, dlopen.3, ecvt.3, errno.3, error.3, ether_aton.3, exit.3, fenv.3, ferror.3, finite.3, flockfile.3, fnmatch.3, fpathconf.3, fpclassify.3, ftime.3, ftok.3, ftw.3, fwide.3, getaddrinfo.3, gethostbyname.3, getlogin.3, getnameinfo.3, getnetent.3, getopt.3, getprotoent.3, getrpcent.3, getservent.3, glob.3, hsearch.3, inet.3, isalpha.3, iswalnum.3, iswalpha.3, iswblank.3, iswcntrl.3, iswctype.3, iswdigit.3, iswgraph.3, iswlower.3, iswprint.3, iswpunct.3, iswspace.3, iswupper.3, iswxdigit.3, longjmp.3, lsearch.3, malloc.3, matherr.3, mblen.3, mbsinit.3, mbtowc.3, on_exit.3, printf.3, pthread_attr_init.3, pthread_attr_setaffinity_np.3, pthread_attr_setdetachstate.3, pthread_attr_setguardsize.3, pthread_attr_setinheritsched.3, pthread_attr_setschedparam.3, pthread_attr_setschedpolicy.3, pthread_attr_setscope.3, pthread_attr_setstack.3, pthread_attr_setstackaddr.3, pthread_attr_setstacksize.3, pthread_cancel.3, pthread_cleanup_push.3, pthread_equal.3, pthread_getattr_np.3, pthread_getcpuclockid.3, pthread_setaffinity_np.3, pthread_setcancelstate.3, pthread_setconcurrency.3, pthread_setschedparam.3, pthread_setschedprio.3, ptsname.3, putenv.3, putgrent.3, raise.3, rcmd.3, regex.3, rexec.3, rpc.3, rpmatch.3, rtnetlink.3, scandir.3, sem_init.3, setaliasent.3, setbuf.3, setenv.3, setjmp.3, signbit.3, stdio_ext.3, strtod.3, strtol.3, strtoul.3, system.3, termios.3, timeradd.3, tzset.3, ualarm.3, wctomb.3, xdr.3, st.4, tty_ioctl.4, core.5, elf.5, proc.5, bootparam.7, capabilities.7, icmp.7, ip.7, ipv6.7, math_error.7, mdoc.samples.7, mq_overview.7, pthreads.7, raw.7, regex.7, socket.7, tcp.7, tzselect.8: Global fix: s/non-zero/nonzero/
The tendency in English, as prescribed in style guides like
Chicago MoS, is towards removing hyphens after prefixes
like "non-" etc.
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2010-01-16 16:40:55 +00:00
|
|
|
The functions return 0 on success and a nonzero error number on failure.
|
getgrent_r.3, gethostbyname.3, getmntent.3, getnetent_r.3, getprotoent_r.3, getpwent_r.3, getrpcent_r.3, getservent_r.3, getspnam.3: Global fix: s/non-reentrant/nonrentrant/
The tendency in English, as prescribed in style guides like
Chicago MoS, is towards removing hyphens after prefixes
like "non-" etc.
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2010-01-16 16:55:51 +00:00
|
|
|
In addition to the errors returned by the nonreentrant
|
2007-08-27 12:24:27 +00:00
|
|
|
versions of these functions, if
|
|
|
|
.I buf
|
|
|
|
is too small, the functions will return
|
|
|
|
.BR ERANGE ,
|
|
|
|
and the call should be retried with a larger buffer.
|
|
|
|
The global variable
|
2004-11-03 13:51:07 +00:00
|
|
|
.I h_errno
|
2007-08-27 12:24:27 +00:00
|
|
|
is not modified, but the address of a variable in which to store error numbers
|
2004-11-03 13:51:07 +00:00
|
|
|
is passed in
|
|
|
|
.IR h_errnop .
|
2008-06-13 10:14:55 +00:00
|
|
|
.SH BUGS
|
|
|
|
.BR gethostbyname ()
|
|
|
|
does not recognize components of a dotted IPv4 address string
|
|
|
|
that are expressed in hexadecimal.
|
|
|
|
.\" http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=482973
|
2004-11-03 13:51:07 +00:00
|
|
|
.SH "SEE ALSO"
|
|
|
|
.BR getaddrinfo (3),
|
2007-10-14 18:16:34 +00:00
|
|
|
.\" .BR getipnodebyaddr (3),
|
|
|
|
.\" .BR getipnodebyname (3),
|
2004-11-03 13:51:07 +00:00
|
|
|
.BR getnameinfo (3),
|
2008-06-13 10:14:55 +00:00
|
|
|
.BR inet (3),
|
2004-11-03 13:51:07 +00:00
|
|
|
.BR inet_ntop (3),
|
|
|
|
.BR inet_pton (3),
|
|
|
|
.BR resolver (3),
|
|
|
|
.BR hosts (5),
|
2005-12-13 15:22:17 +00:00
|
|
|
.BR nsswitch.conf (5),
|
2004-11-03 13:51:07 +00:00
|
|
|
.BR hostname (7),
|
2005-12-13 15:22:17 +00:00
|
|
|
.BR named (8)
|
|
|
|
.\" .BR resolv+ (8)
|