/* Put the name of the current NIS domain in no more than LEN bytes of NAME. The result is null-terminated if LEN is large enough for the full name and the terminator. */ int getdomainname (char *name, size_t len) { /* The NIS domain name is just the contents of the file /etc/nisdomain. */ ssize_t n = _hurd_get_host_config ("/etc/nisdomain", name, len); return n < 0 ? -1 : 0; }
/* Put the name of the current host in no more than LEN bytes of NAME. The result is null-terminated if LEN is large enough for the full name and the terminator. */ int __gethostname (char *name, size_t len) { /* The host name is just the contents of the file /etc/hostname. */ ssize_t n = _hurd_get_host_config ("/etc/hostname", name, len); return n < 0 ? -1 : 0; }
/* Return the current machine's Internet number. */ long int DEFUN_VOID(gethostid) { /* The hostid is just the contents of the file /etc/hostid, kept as text of hexadecimal digits. */ char buf[8]; ssize_t n = _hurd_get_host_config ("/etc/hostid", buf, sizeof buf); if (n < 0) return -1; return strtol (buf, NULL, 16); }
/* Return the current machine's Internet number. */ long int gethostid () { /* The hostid is just the contents of the file /etc/hostid, kept as text of hexadecimal digits. */ /* XXX this is supposed to come from the hardware serial number */ char buf[8]; ssize_t n = _hurd_get_host_config ("/etc/hostid", buf, sizeof buf); if (n < 0) return -1; return strtol (buf, NULL, 16); }