*nix Documentation Project
·  Home
 +   man pages
·  Linux HOWTOs
·  FreeBSD Tips
·  *niX Forums

  man pages->HP-UX 11i man pages -> gethostname (2)              
Title
Content
Arch
Section
 

Contents


 gethostname(2)                                               gethostname(2)




 NAME    [Toc]    [Back]
      gethostname - get name of current host

 SYNOPSIS    [Toc]    [Back]
      #include <unistd.h>

      int gethostname(char *hostname, size_t size);

 DESCRIPTION    [Toc]    [Back]
      gethostname() returns in the array to which hostname points, the
      standard host name for the current processor as set by sethostname()
      (see sethostname(2)).  size specifies the length of the hostname
      array.  hostname is null-terminated unless insufficient space is
      provided.

 RETURN VALUE    [Toc]    [Back]
      gethostname() returns 0 if successful.  Otherwise, it returns -1 and
      sets errno to indicate the error.

 ERRORS    [Toc]    [Back]
      gethostname() can fail if the following is true:

      [EFAULT]       hostname points to an illegal address.  The reliable
                     detection of this error is implementation dependent.

      [EINVAL]       size is less than one.

 AUTHOR    [Toc]    [Back]
      gethostname() was developed by the University of California, Berkeley.

 SEE ALSO    [Toc]    [Back]
      hostname(1), uname(1), sethostname(2), uname(2).


 Hewlett-Packard Company            - 1 -   HP-UX 11i Version 2: August 2003
[ Back ]
      
      
 Similar pages
Name OS Title
sethostname NetBSD get/set name of current host
sethostname FreeBSD get/set name of current host
gethostname NetBSD get/set name of current host
gethostname FreeBSD get/set name of current host
sethostname OpenBSD get/set name of current host
gethostname IRIX get/set name of current host
sethostname Tru64 Set the name of the current host
gethostname OpenBSD get/set name of current host
setdomainname FreeBSD get/set the NIS domain name of current host
gethostid HP-UX get an identifier for the current host
Copyright © 2004-2005 DeniX Solutions SRL
newsletter delivery service