Back to index

glibc  2.9
sethostid.c File Reference
#include <unistd.h>
#include <hurd.h>
#include "hurdhost.h"
#include <stdio-common/_itoa.h>

Go to the source code of this file.


int sethostid (long int id)

Function Documentation

int sethostid ( long int  id)

Definition at line 29 of file sethostid.c.

  char buf[8], *bp;
  ssize_t n;

  /* The hostid is kept in the file /etc/hostid,
     eight characters of upper-case hexadecimal.  */

  bp = _itoa_word (id, &buf[sizeof buf], 16, 1);
  while (bp > buf)
    *--bp = '0';

  n = _hurd_set_host_config ("/etc/hostid", buf, sizeof buf);
  return n < 0 ? -1 : 0;

Here is the call graph for this function: