gethostid,  sethostid - get or set the unique identifier of the current


   #include <unistd.h>

   long gethostid(void);
   int sethostid(long hostid);

   Feature Test Macro Requirements for glibc (see feature_test_macros(7)):

       _BSD_SOURCE || _XOPEN_SOURCE >= 500
       Since glibc 2.21:
       In glibc 2.19 and 2.20:
       Up to and including glibc 2.19:
           _BSD_SOURCE || (_XOPEN_SOURCE && _XOPEN_SOURCE < 500)


   gethostid() and sethostid() respectively get or  set  a  unique  32-bit
   identifier  for the current machine.  The 32-bit identifier is intended
   to be unique among  all  UNIX  systems  in  existence.   This  normally
   resembles  the  Internet  address for the local machine, as returned by
   gethostbyname(3), and thus usually never needs to be set.

   The sethostid() call is restricted to the superuser.


   gethostid() returns the 32-bit identifier for the current host  as  set
   by sethostid().

   On  success, sethostid() returns 0; on error, -1 is returned, and errno
   is set to indicate the error.


   sethostid() can fail with the following errors:

   EACCES The caller did not have permission to write to the file used  to
          store the host ID.

   EPERM  The calling process's effective user or group ID is not the same
          as its corresponding real ID.


   For  an  explanation  of  the  terms  used   in   this   section,   see

   Interface    Attribute      Value                     
   gethostid()  Thread safety  MT-Safe hostid env locale 
   sethostid()  Thread safety  MT-Unsafe const:hostid    


   4.2BSD;   these  functions  were  dropped  in  4.4BSD.   SVr4  includes
   gethostid() but not sethostid().

   POSIX.1-2001 and POSIX.1-2008 specify gethostid() but not sethostid().


   In  the  glibc  implementation,  the  hostid  is  stored  in  the  file
   /etc/hostid.   (In  glibc versions before 2.2, the file /var/adm/hostid
   was used.)

   In the glibc  implementation,  if  gethostid()  cannot  open  the  file
   containing   the   host   ID,   then  it  obtains  the  hostname  using
   gethostname(2), passes that hostname to gethostbyname_r(3) in order  to
   obtain  the  host's  IPv4 address, and returns a value obtained by bit-
   twiddling the IPv4 address.  (This value may not be unique.)


   It is impossible to ensure that the identifier is globally unique.


   hostid(1), gethostbyname(3)


   This page is part of release 4.09 of the Linux  man-pages  project.   A
   description  of  the project, information about reporting bugs, and the
   latest    version    of    this    page,    can     be     found     at

More Linux Commands

checkpto(1) - Helper program for Hugin's Makefile assistant
checkpto checks a single Hugin .pto project, it returns failure if the .pto file cant be parsed, or if control point connections between photos do not form a co

Tcl_DictObjDone(3) - manipulate Tcl objects as dictionaries
Tcl dictionary objects have an internal representation that supports efficient mapping from keys to values and which guarantees that the particular ordering of

XwcDrawText(3) - draw text using multiple font sets.........
The XmbDrawText, XwcDrawText and Xutf8DrawText functions allow complex spacing and font set shifts between text strings. Each text item is processed in turn, wi

field_opts_on(3form) - set and get field options (Man Page)
The function set_field_opts sets all the given fields option bits (field option bits may be logically-ORed together). The function field_opts_on turns on the gi

pcre16_free_substring_list(3) Perl-compatible regular expres
This is a convenience function for freeing the store obtained by a previous call to pcre[16|32]_get_substring_list(). Its only argument is a pointer to the list

SDL_CreateRGBSurface(3) - Create an empty SDL_Surface.......
Allocate an empty surface (must be called after SDL_SetVideoMode) If depth is 8 bits an empty palette is allocated for the surface, otherwise a packed-pixel SDL

glClearAccum(3gl) - specify clear values for the accumulatio
glClearAccum specifies the red, green, blue, and alpha values used by glClear to clear the accumulation buffer. Values specified by glClearAccum are clamped to

gnutls_global_deinit(3) - API function - Linux manual page
This function deinitializes the global data, that were initialized using gnutls_global_init(). Note! This function is not thread safe. See the discussion for gn

sasl_auxprop_getctx(3) - Acquire an auxiliary property conte
sasl_auxprop_getctx will return an auxiliary property context for the given sasl_conn_t on which the functions described in sasl_auxprop(3) can operate. conn th

getdate(3) - convert a date-plus-time string to broken-down
The function getdate() converts a string representation of a date and time, contained in the buffer pointed to by string, into a broken-down time. The broken-do

tgammaf(3) - true gamma function (Library - Linux man page)
The Gamma function is defined by Gamma(x) = integral from 0 to infinity of t^(x-1) e^-t dt It is defined for every real number except for nonpositive integers.

XDGAQueryVersion(3) - Client library for the XFree86-DGA ext
The XFree86-DGA extension is an X server extension for allowing client programs direct access to the video frame buffer. This is a brief description of the prog

We can't live, work or learn in freedom unless the software we use is free.