getdomainname function
Get and set the NIS (aka YP) domain name, if any.
Called just like gethostname' and sethostname'.
The NIS domain name is usually the empty string when not using NIS.
Implementation
int getdomainname(
String name, // ffi.Pointer<Utf8> name,
int len,
) {
if (len < 0 || len > utf8.encode(name).length + 1) {
throw RangeError.value(len, 'len', 'exceeds the supplied buffer');
}
final cName = toNativeUtf8Checked(name);
_getdomainname ??= Libc().dylib.lookupFunction<
ffi.Int32 Function(ffi.Pointer<Utf8>, ffi.Uint64),
_dart_getdomainname>('getdomainname');
final result = _getdomainname!(
cName,
len,
);
malloc.free(cName);
return result;
}