Museum

Home

Lab Overview

Retrotechnology Articles

Online Manuals

⇒ gethostname(3) — AIX/RT 2.2.1

Media Vault

Software Library

Restoration Projects

Artifacts Sought

Related Articles

gethostid, sethostid

hostname

     gethostname, sethostname

Purpose

     Gets or sets the name of the current host.

Library

     Sockets Library (libsock.a)

Syntax

     int gethostname (name, namelen)           int sethostname (name, namelen)
     char *name;                               char *name;
     int namelen;                              int namelen;
     Description

     The gethostname subroutine returns the standard host name
     of the current host, as set by sethostname. The parameter
     namelen  specifies  the  size  of the  name  array.   The
     returned  name  is  null-terminated  unless  insufficient
     space is provided.

     The  sethostname subroutine  sets  the name  of the  host
     machine name with the length namelen. This subroutine can
     only be  used by processes  with an effective user  ID of
     superuser.  In the AIX Operating System, the host name of
     a machine is usually set by the Interface Program for use
     with    TCP/IP    in     its    initialization    program
     (/etc/rc.tcpip).

     Return Value

     Upon successful completion, a value of 0 is returned.  If
     the gethostname or sethostname  routine fails, a value of
     -1 is returned, and errno is set to indicate the error.

     Diagnostics

     The subroutine fails if one  or more of the following are
     true:

     EFAULT            The name parameter or namelen parameter
                       gives an address that is not valid.

     EPERM             The  calling process  did  not have  an
                       effective user ID of superuser.

     Related Information

     In this book:  "gethostid, sethostid."

     The hostname  command in  Interface Program for  use with
     TCP/IP.

Typewritten Software • bear@typewritten.org • Edmonds, WA 98026