nix::unistd

Function sethostname

Source
pub fn sethostname<S: AsRef<OsStr>>(name: S) -> Result<()>
Expand description

Set the system host name (see sethostname(2)).

Given a name, attempt to update the system host name to the given string. On some systems, the host name is limited to as few as 64 bytes. An error will be returned if the name is not valid or the current process does not have permissions to update the host name.