]>
git.proxmox.com Git - wasi-libc.git/blob - libc-top-half/musl/src/unistd/gethostname.c
2 #include <sys/utsname.h>
4 int gethostname(char *name
, size_t len
)
8 if (uname(&uts
)) return -1;
9 if (len
> sizeof uts
.nodename
) len
= sizeof uts
.nodename
;
10 for (i
=0; i
<len
&& (name
[i
] = uts
.nodename
[i
]); i
++);
11 if (i
&& i
==len
) name
[i
-1] = 0;