gethostid(2) CLIX gethostid(2)
NAME
gethostid, sethostid - Gets/sets unique identifier of current host
SYNOPSIS
int gethostid(
void );
int sethostid(
long hostid );
PARAMETERS
hostid Specifies a 32-bit identifier.
DESCRIPTION
The gethostid() function returns the 32-bit identifier for the host
machine. No errors are possible.
The sethostid() function establishes a 32-bit identifier for the host
machine intended to be unique among all UNIX systems in existence. This
is normally a Defense Advanced Research Project Agency (DARPA) Internet
address for the local machine.
EXAMPLES
1. To get the host identifier:
hostid=gethostid();
2. To set the hostid:
if (sethostid(hostid) == -1)
perror("sethostid failed");
NOTES
Only the superuser can execute the gethostid() function.
RETURN VALUES
The gethostid() function returns the machine identifier. Upon successful
completion, a value of 0 is returned. Otherwise, a value of -1 is
returned and errno is set to indicate the error.
ERRORS
2/94 - Intergraph Corporation 1
gethostid(2) CLIX gethostid(2)
The sethostid() function fails if the following is true:
[EPERM] The caller is not the superuser.
RELATED INFORMATION
Functions: gethostname(2)
2 Intergraph Corporation - 2/94