sethostname function
Set the name of the current host to NAME. This call is restricted to the super-user.
Implementation
int sethostname(
String name, // ffi.Pointer<Utf8> name,
) {
final cName = name.toNativeUtf8();
_sethostname ??= Libc().dylib.lookupFunction<
ffi.Int32 Function(ffi.Pointer<Utf8>, ffi.Uint64),
_dart_sethostname>('sethostname');
final result = _sethostname!(
cName,
name.length,
);
_throwIfErrno('gethostname', result, cName);
malloc.free(cName);
return result;
}