Go to main content

man pages section 3: Library Interfaces and Headers

Exit Print View

Updated: Wednesday, July 27, 2022
 
 

ares_gethostbyname_file (3)

Name

ares_gethostbyname_file - Lookup a name in the system's hosts file

Synopsis

#include <ares.h>

int ares_gethostbyname_file(ares_channel channel, const char *name,
int family, struct hostent **host)

Description

ARES_GETHOSTBYNAME(3)      Library Functions Manual      ARES_GETHOSTBYNAME(3)



NAME
       ares_gethostbyname_file - Lookup a name in the system's hosts file

SYNOPSIS
       #include <ares.h>

       int ares_gethostbyname_file(ares_channel channel, const char *name,
            int family, struct hostent **host)

DESCRIPTION
       The  ares_gethostbyname_file  function  performs  a host lookup by name
       against the system's hosts file (or  equivalent  local  hostname  data-
       base).   The channel parameter is required, but no asynchronous queries
       are performed.  Instead, the lookup is done via the same mechanism used
       to   perform   'f'   lookups   (see   the   lookups  options  field  in
       ares_init_options(3)).  The parameter name gives the hostname as a NUL-
       terminated  C  string, and family gives the desired type of address for
       the resulting host entry.

       The return value indicates whether the query succeeded and, if not, how
       it failed.  It may have any of the following values:

       ARES_SUCCESS       The  host lookup completed successfully and host now
                          points  to  the  result  (and  must  be  freed  with
                          ares_free_hostent(3)).

       ARES_ENOTFOUND     The hostname name was not found.

       ARES_EFILE         There  was  a  file  I/O  error while performing the
                          lookup.

       ARES_ENOMEM        Memory was exhausted.

       On successful completion of the query, the pointer pointed to  by  host
       points  to a struct hostent containing the address of the host returned
       by the lookup.  The user must free the memory pointed to by  host  when
       finished  with  it  by calling ares_free_hostent(3).  If the lookup did
       not complete successfully, host will be NULL.

AVAILABILITY
       Added in c-ares 1.5.4


ATTRIBUTES
       See attributes(7) for descriptions of the following attributes:


       +---------------+------------------+
       |ATTRIBUTE TYPE | ATTRIBUTE VALUE  |
       +---------------+------------------+
       |Availability   | library/libcares |
       +---------------+------------------+
       |Stability      | Volatile         |
       +---------------+------------------+

SEE ALSO
       ares_gethostbyname(3), ares_free_hostent(3), ares_init_options(3)

AUTHOR
       Brad Spencer
       Copyright 1998 by the Massachusetts Institute of Technology.



NOTES
       Source code for open source software components in Oracle  Solaris  can
       be found at https://www.oracle.com/downloads/opensource/solaris-source-
       code-downloads.html.

       This    software    was    built    from    source     available     at
       https://github.com/oracle/solaris-userland.    The  original  community
       source   was   downloaded   from     https://c-ares.haxx.se/download/c-
       ares-1.17.2.tar.gz.

       Further information about this software can be found on the open source
       community website at https://c-ares.haxx.se/.



                                 25 July 1998            ARES_GETHOSTBYNAME(3)