1 /* gethostname(2) system call emulation */
12 __weak_alias(gethostname
, _gethostname
)
15 #define HOSTNAME_FILE "/etc/hostname.file"
17 int gethostname(char *buf
, size_t len
)
23 if ((fd
= open(HOSTNAME_FILE
, O_RDONLY
)) < 0) return -1;
25 r
= read(fd
, buf
, len
);
27 if (r
== -1) return -1;
30 if ((nl
= strchr(buf
, '\n')) != NULL
) *nl
= '\0';